Skip to content
This repository has been archived by the owner on Aug 31, 2022. It is now read-only.

[telemetry] Reload telemetry server configuration. #92

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

yozhao101
Copy link
Contributor

@yozhao101 yozhao101 commented Jan 25, 2022

Signed-off-by: Yong Zhao yozhao@microsoft.com

  • Why I did it
    We want to reload the configuration of telemetry server if the certificate and key files are rotated. This PR is related to: [telemetry] Rotate streaming telemetry secrets. sonic-buildimage#9600.

  • How I did it
    I created a signal hander which will stop current gRPC server and then create a new one with updated credentials if signal SIGHUP was received.

  • How to verify it
    I did this implementation and tested them on a virtual switch.

…ing the `SIGHUP` signal.

Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@yozhao101 yozhao101 marked this pull request as ready for review January 26, 2022 18:09
Signed-off-by: Yong Zhao <yozhao@microsoft.com>
@yozhao101
Copy link
Contributor Author

@zbud-msft Can you please help me review this PR?

// updated certificate and key files.
func SignalHandler(server *gnmi.Server, signalChannel <-chan os.Signal) {
signalReceiver := <-signalChannel
log.V(1).Infof("gRPC server receives signal: %s and will be stopped!", signalReceiver)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should check that the signal received from channel is sighup before stopping server in case we want to reuse signal handler

// SignalHandler will block and wait for the signal `SIGHUP`. Once it receives signal,
// the gRPC server will be stopped and new gRPC server instance will be created with
// updated certificate and key files.
func SignalHandler(server *gnmi.Server, signalChannel <-chan os.Signal) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SignalHandler

Please add a sonic-mgmt test case and test the process of certificate rotation.

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

Successfully merging this pull request may close these issues.

3 participants