Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: service LocallyRegisteredAsSidecar property is not persisted #8924

Merged

Conversation

ShimmerGlass
Copy link
Contributor

When a service is deregistered, we check whever matching services were
registered as sidecar along with it and deregister them as well.
To determine if a service is indeed a sidecar we check the
structs.ServiceNode.LocallyRegisteredAsSidecar property. However, to
avoid interal API leakage, it is excluded from JSON serialization,
meaning it is not persisted to disk either.
When the agent is restarted, this property lost and sidecars are no
longer deregistered along with their parent service.
To fix this, we now specifically save this property in the persisted
service file.

@ShimmerGlass ShimmerGlass force-pushed the fix-sidecar-deregister-after-restart branch from bf248fe to dd08a90 Compare October 12, 2020 19:55
@rboyer rboyer added the theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies label Oct 12, 2020
@ShimmerGlass ShimmerGlass force-pushed the fix-sidecar-deregister-after-restart branch from dd08a90 to d26e321 Compare October 13, 2020 09:01
@dnephin dnephin added the type/bug Feature does not function as expected label Oct 13, 2020
Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the PR! This looks good. Could you please also add a .changelog/8924.txt file so that this fix shows up in the changelog.

When a service is deregistered, we check whever matching services were
registered as sidecar along with it and deregister them as well.
To determine if a service is indeed a sidecar we check the
structs.ServiceNode.LocallyRegisteredAsSidecar property. However, to
avoid interal API leakage, it is excluded from JSON serialization,
meaning it is not persisted to disk either.
When the agent is restarted, this property lost and sidecars are no
longer deregistered along with their parent service.
To fix this, we now specifically save this property in the persisted
service file.
@ShimmerGlass ShimmerGlass force-pushed the fix-sidecar-deregister-after-restart branch from d26e321 to 1c8369b Compare October 13, 2020 17:39
@ShimmerGlass
Copy link
Contributor Author

@dnephin Added the changelog. Is the wording OK?

Copy link
Contributor

@pierresouchay pierresouchay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ShimmerGlass
Copy link
Contributor Author

@dnephin Did you have time to take a look? Dead sidecars pile up on our side as we restart consul agents pretty often in our PAAS.

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you for the fix!

@dnephin dnephin merged commit 3a55c30 into hashicorp:master Oct 22, 2020
@hashicorp-ci
Copy link
Contributor

🍒✅ Cherry pick of commit 3a55c30 onto release/1.8.x succeeded!

hashicorp-ci pushed a commit that referenced this pull request Oct 22, 2020
…er-restart

Fix: service LocallyRegisteredAsSidecar property is not persisted
@ShimmerGlass
Copy link
Contributor Author

Thank you !

@ShimmerGlass ShimmerGlass deleted the fix-sidecar-deregister-after-restart branch October 22, 2020 18:09
@SamaChandra
Copy link

Hi here. I am facing an issue with Consul service mesh upgrade. earlier I am using helm chart 1.6.0 and it was working fine . After upgrading to 1.9.0 I am facing a lot of issues with consul service mesh especially services are not getting de-registered when I deploy a new pod using helm package manager.I am seeing 2 to 3 instances in each service and I am trying to de-register them by logging into the POD, but unable to deregister some of the services.. Due to this my ambassador endpoint API gateway is unable to connect to the services and due to this I am unable to connect to any services..it is causing a big issue.

image

@chenjinkai
Copy link

@SamaChandra I have encountered the same problem. Have you solved it now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/connect Anything related to Consul Connect, Service Mesh, Side Car Proxies type/bug Feature does not function as expected
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants