mirror of https://github.com/status-im/consul.git
Ensure we remove Connect proxy before deregistering the service itself (#5482)
This will fix https://github.com/hashicorp/consul/issues/5351
This commit is contained in:
parent
585978ab94
commit
88d4383410
|
@ -2075,6 +2075,17 @@ func (a *Agent) removeServiceLocked(serviceID string, persist bool) error {
|
|||
checkIDs = append(checkIDs, id)
|
||||
}
|
||||
|
||||
// Remove the associated managed proxy if it exists
|
||||
// This has to be DONE before purging configuration as might might have issues
|
||||
// With ACLs otherwise
|
||||
for proxyID, p := range a.State.Proxies() {
|
||||
if p.Proxy.TargetServiceID == serviceID {
|
||||
if err := a.removeProxyLocked(proxyID, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Remove service immediately
|
||||
if err := a.State.RemoveServiceWithChecks(serviceID, checkIDs); err != nil {
|
||||
a.logger.Printf("[WARN] agent: Failed to deregister service %q: %s", serviceID, err)
|
||||
|
@ -2098,15 +2109,6 @@ func (a *Agent) removeServiceLocked(serviceID string, persist bool) error {
|
|||
}
|
||||
}
|
||||
|
||||
// Remove the associated managed proxy if it exists
|
||||
for proxyID, p := range a.State.Proxies() {
|
||||
if p.Proxy.TargetServiceID == serviceID {
|
||||
if err := a.removeProxyLocked(proxyID, true); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
a.logger.Printf("[DEBUG] agent: removed service %q", serviceID)
|
||||
|
||||
// If any Sidecar services exist for the removed service ID, remove them too.
|
||||
|
|
Loading…
Reference in New Issue