Backport of Fix gateway services cleanup where proxy deregistration happens after service deregistration into release/1.15.x #18856
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport
This PR is a backport of #18831 to release/1.15.x
The below text is copied from the body of the original PR.
Description
While trying to debug a customer issue, I noticed that when:
"*"
This happens because of a bug in the store that was causing wildcard-targeted gateway services to be pruned from
tableGatewayServices
only when they don't have existing sidecar proxies. In the above case, when the sidecar is deregistered second, the cleanup routine never triggers for the main service (instead a routine runs that attempts to prune the sidecar service name fromtableGatewayServices
rather than the service it's acting as a sidecar for).Testing & Reproduction steps
I added a unit test to exercise this case, but I also threw together a gist that manually recreates this. I did so using an enterprise Consul build, but the steps can be adjusted for non-enterprise as well.
consul-enterprise
build withmake dev-docker
and tag it withdocker tag consul:local consul-enterprise:local
CONSUL_LICENSE
./reset.sh
in the gistkubectl delete deployment static-server
kubectl exec -it consul-server-0 -- consul catalog services
and see thatstatic-server
is not longer in the catalogkubectl exec -it consul-server-0 -- curl https://localhost:8501/v1/catalog/gateway-services/consul-dc1-ingress-gateway -k | jq
Without the fix you'll see something like (notice
static-server
still in the payload):With the fix you should see something like:
PR Checklist
Overview of commits
087539f