-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
EnableTagOverride issue #1572
Comments
btw, in my setup there are 3 consul servers |
Hi @wyhysj are you using the Catalog API to update the tags (https://www.consul.io/docs/agent/http/catalog.html)? If you are not using the Catalog API and change them using the Agent API then the stale catalog value will overwrite it, which sounds like what might be happening here. |
@slackpad yes, I use Catalog API to update tags |
Ah that explains it - it needs the client and server to both be >=0.6.0 in order to work. The server has to support storing the new field and then the client is the one who honors it and takes the tags from the server instead of sending its own tags up every time. |
@slackpad Thanks for the clarify
I use /v1/catalog/register api and my body.json looks like this
|
@wyhysj sorry about this - running through an example now I can see how this is confusing - I think we should beef up our documentation a bit. Syncing of service registration usually happens from the agents up to the servers. The tag override feature is a rare case that goes the other way. When the agent is syncing, it fetches what's on the server, compares it with what it has, and then pushes up any changes. I think the problem you are seeing is that the agent doesn't have the Here's an example that shows how it works: Register the service on the agent using the agent API Note that we enable tag overrides when we register the service with the agent here.
Verify that the standby tag is set in the catalog Note here that the server captured the agent's tag override setting.
Update the tag using the catalog
Verify that the agent doesn't overwrite it
Verify that the agent took the tags from the master into its local configuration
Please let me know if this makes sense! |
@slackpad Thanks for such detailed explanation |
Glad it's working - keeping open to touch up the docs. |
@slackpad , Thank you from me too. There are two ways to change the tags of an existing service:
If you want to use way 1, create the service with EnableTagOverride: true. Because otherwise the tags will be run over. Advanced note: It seems that v1/agent/service/register sends the new tags to the catalog regardless of EnableTagOverride. So if you use way 2 yet with EnableTagOverride: true, it will 99% work. The only problem is if you call v1/agent/service/register while the cluster is unavailable; then the registration on the agent will succeed, but it won't send the tag to the server upon re-connection! |
@motty-stratoscale that sounds right, and is a bit subtle, unfortunately. The semantics of |
I'd like to add one minor caveat here for posterity that had me confused, but ultimately was not a problem. If you update tags for a service with If you are using a client library, it's almost certain you'll run into this. The docs don't show that you can in fact pass EnableTagOverride as a Service property in the |
https://www.consul.io/api/agent/service.html#enabletagoverride has better docs now that are explaining it well imho. Closing because I think this is solved. Let me know if you disagree. |
Since consul 0.6, a new option called enabletagoverride provide us a gateway to dynamically append tags to an existing service
however, I tried to use it but it only last less than 1 minutes, the tag will sync to old value
Is there something I'm missing?
The text was updated successfully, but these errors were encountered: