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

Support server name configuration #243

Open
davidkemper opened this issue Jan 22, 2020 · 1 comment
Open

Support server name configuration #243

davidkemper opened this issue Jan 22, 2020 · 1 comment

Comments

@davidkemper
Copy link

Recently the nats-server added support for a more human-readable server name.

It would be nice to add support for it in the nats-operator.

As it stands now, the server identifier (e.g., NAICD2C2WZ62VH7QELNX6LLI6BBY34SL3MVD3FCJVMJCSOOBOZ7YZ7N3) appears in monitoring stacks like Prometheus. While unique, it is not friendly.

A possible implementation might chose an operator DSL attribute to control the name prefix of the server. For example, <prefix>-<server-number> ==> mycluster-1 for the first server. The prefix could default to the nats-cluster metadata name. Note that using just the nats-cluster metadata name might result in naming collisions when consolidating monitoring for multiple clusters, so allowing an explicit prefix would be "nice".

The nats-operator currently uses a single configuration secret that it maps to each server pod. I believe this makes the solution non-trivial.

@wallyqs
Copy link
Member

wallyqs commented Jan 22, 2020

The problem with the shared config is that since JSON is used to marshal the config, then cannot use an environment variable to set the server name since it will be using quotes. The options are then:

  • Improve the config marshalling of the nats operator so that can have fields that are environment variables which are unquoted
  • Make nats-servers be able to set a name via the command line instead of via the config where $POD_NAME would be used
  • Change nats-server to use some environment variable as the server_name instead of config

Reference example of how this works with statefulsets: https://gist.github.com/wallyqs/025d3ceffe2d40cec7ce02a97ae76617#file-server-name-yml-L8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants