Skip to content

Commit

Permalink
Fix namespaced peer service updates / deletes.
Browse files Browse the repository at this point in the history
This change fixes a function so that namespaced services are
correctly queried when handling updates / deletes. Prior to this
change, some peered services would not correctly be un-exported.
  • Loading branch information
hashi-derek committed May 24, 2023
1 parent b8eb98f commit dc995c1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
6 changes: 4 additions & 2 deletions agent/grpc-external/services/peerstream/replication.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,9 +285,11 @@ func (s *Server) handleUpsertExportedServiceList(
exportedServices[snSidecarProxy] = struct{}{}
serviceNames = append(serviceNames, sn)
}
entMeta := structs.NodeEnterpriseMetaInPartition(partition)

_, serviceList, err := s.GetStore().ServiceList(nil, entMeta, peerName)
// Ensure we query services from all namespaces in this partition when we perform
// this query or else we may not propagate updates / deletes correctly.
entMeta := acl.NewEnterpriseMetaWithPartition(partition, acl.WildcardName)
_, serviceList, err := s.GetStore().ServiceList(nil, &entMeta, peerName)
if err != nil {
return err
}
Expand Down
3 changes: 2 additions & 1 deletion agent/grpc-external/services/peerstream/stream_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1960,7 +1960,7 @@ func processResponse_ExportedServiceUpdates(
localEntMeta acl.EnterpriseMeta,
peerName string,
tests []PeeringProcessResponse_testCase,
) {
) *MutableStatus {
// create a peering in the state store
peerID := "1fabcd52-1d46-49b0-b1d8-71559aee47f5"
require.NoError(t, store.PeeringWrite(31, &pbpeering.PeeringWriteRequest{
Expand Down Expand Up @@ -2041,6 +2041,7 @@ func processResponse_ExportedServiceUpdates(
run(t, tc)
})
}
return mst
}

func Test_processResponse_ExportedServiceUpdates(t *testing.T) {
Expand Down

0 comments on commit dc995c1

Please sign in to comment.