fix(mesh-gateway): remove deregistered service from mesh gateway (#15272)
* fix(mesh-gateway): remove deregistered service from mesh gateway * changelog Co-authored-by: Derek Menteer <105233703+hashi-derek@users.noreply.github.com> Co-authored-by: Evan Culver <eculver@users.noreply.github.com>
This commit is contained in:
parent
eee0fb1035
commit
3d2d7a77cb
|
@ -0,0 +1,3 @@
|
|||
```release-note:bug
|
||||
proxycfg(mesh-gateway): Fix issue where deregistered services are not removed from mesh-gateway clusters.
|
||||
```
|
|
@ -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
|
||||
|
|
|
@ -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…
Reference in New Issue