cockroach-operator icon indicating copy to clipboard operation
cockroach-operator copied to clipboard

Allow users to specify a suffix for `--advertise-host` argument

Open ADustyOldMuffin opened this issue 3 years ago • 3 comments

As found here the --advertise-host argument is built based on the pod name, and the namespace. In our instance our nodes exist in different Kubernetes clusters, but have the same podnames and namespace. What makes our nodes uniquely identifiable is their FQDN (what cluster they're in).

I know it's not supported but would it make sense to have an option to specify a suffix for these names?

So the code would look something like

suffix := ""
if b.Spec().AdvertiseSuffix != nil {
    suffix = fmt.Sprintf(".%s", *b.Spec().AdvertiseSuffix)
}

...
fmt.Sprintf("--advertise-host=$(POD_NAME).%s.%s",
    b.Cluster.DiscoveryServiceName(), b.Cluster.Namespace(), suffix)

Or something of the sort.

ADustyOldMuffin avatar Apr 26 '22 16:04 ADustyOldMuffin

I wonder if we could use the utility added by #894 to easily address this problem? Another alternative would be to use hostname -f in favor of manually constructing the --advertise-host flag.

@ADustyOldMuffin would you mind sharing the (potentially redacted) output of the following commands on the cluster(s) that you're running?

# From a cockroachDB Pod
hostname -f

# From anywhere
# If running on stock CRDB containers, you may need to run: microdnf install bind-utils
nslookup kubernetes.default.svc

chrisseto avatar Jul 12 '22 17:07 chrisseto