nats-io / nats-operator

NATS Operator
https://nats-io.github.io/k8s/
Apache License 2.0
574 stars 111 forks source link

added custom signal, refactored loop #338

Closed siredmar closed 2 years ago

siredmar commented 2 years ago

This PR allows the config reloader to send a custom signal to the nats server. This can be useful where the user is forced to restart the nats server in order to load a modified configuration (e.g. modified leafnode settings).

Using the config reloader, this PR fixes https://github.com/nats-io/nats-server/issues/1921 as a workaround by allowing the reloader to send a custom signal, e.g. sigterm forcing to terminate the nats server. On the next startup the new configuration will be used.

wallyqs commented 2 years ago

Thanks for the contribution! I will merge as is since LGTM, but actually the main source of the reloader process was moved to be located at: https://github.com/nats-io/nack/blob/main/cmd/nats-server-config-reloader/main.go so I have ported over your changes as part of this PR: https://github.com/nats-io/nack/pull/62