-
Notifications
You must be signed in to change notification settings - Fork 326
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
Catalog: support registering in configured datacenter vs defaulting to agent's #3792
Comments
@jukie Out of curiosity did this config perhaps not work for you externalServers? This allows you to set the servers you want catalog Sync to point to. |
Right but when connecting to those external servers it still won't respect the configured datacenter as a target registration. For example I'm using servers in datacenter A but I want the registered services to be registered under datacenter B. When not set in the catalog registration api call it defaults to the datacenter of the Agent being used and in this example would incorrectly register services under datacenter A even though a Other components here respect the configured datacenter and do a similar setup as proposed in my PR. This is also the behavior implied by the help text output. |
I have to ask a few more questions to understand his more:
I'm curious how you're able to get datacenters in Consul running without Consul servers? My understanding that a consul datacenter == a consul cluster with a set of Consul servers running. Is this use case perhaps to registering the same service across multiple Consul clusters, for high availability? |
Sorry you're correct and that's a fair question, I mistakenly misrepresented my constraint. There are consul servers in the target datacenter but for a few reasons I may not be targeting them as the Fixing that is something that will be done with our setup but Sync Catalog should probably be respecting the datacenter flag or env var anyways since the API supports this and is how other components here operate. If I may ask, is there any reason not to add this change? If the API for catalog registration supports this it seems like this was the intended behavior and was a gap in consul-k8s because in 99% of cases a user would logically be registering services in the same datacenter as the agent sync catalog is communicating with. At least that's how it appears to be getting used in places like below. It gets the configured datacenter through the main command flags (or env var) and then adds that to the relevant controller or resource and sets the target datacenter in various api calls or uses it for filtering logic. api-gateway:
inject-connect:
|
Community Note
Is your feature request related to a problem? Please describe.
For my org we have a few datacenters without Consul servers running so for Catalog Sync I'd like services to be registered in the datacenter configured by cli flag or CONSUL_DATACENTER env var. However, because Catalog Sync doesn't check for this the resulting catalog registration will default to the datacenter of the agent it's communicating with.
Feature Description
Catalog Sync should respect the
-datacenter
cli flag or CONSUL_DATACENTER env var when registering servicesUse Case(s)
Explained above
Contributions
Yes, will open a PR
The text was updated successfully, but these errors were encountered: