Browse Source

fix(mesh-gateway): remove deregistered service from mesh gateway

pull/15272/head
cskh 2 years ago
parent
commit
8083bba320
  1. 3
      agent/proxycfg/mesh_gateway.go
  2. 4
      agent/proxycfg/snapshot.go

3
agent/proxycfg/mesh_gateway.go

@ -258,6 +258,9 @@ func (s *handlerMeshGateway) handleUpdate(ctx context.Context, u UpdateEvent, sn
// Do those endpoints get cleaned up some other way?
delete(snap.MeshGateway.WatchedServices, sid)
cancelFn()
// always remove the sid from the ServiceGroups when un-watch the service
delete(snap.MeshGateway.ServiceGroups, sid)
}
}
snap.MeshGateway.WatchedServicesSet = true

4
agent/proxycfg/snapshot.go

@ -482,6 +482,10 @@ func (c *ConfigSnapshot) MeshGatewayValidExportedServices() []structs.ServiceNam
continue // not possible
}
if _, ok := c.MeshGateway.ServiceGroups[svc]; !ok {
continue // unregistered services
}
chain, ok := c.MeshGateway.DiscoveryChain[svc]
if !ok {
continue // ignore; not ready

Loading…
Cancel
Save