openconfig / gnmic

gNMIc is a gNMI CLI client and collector
https://gnmic.openconfig.net
Apache License 2.0
170 stars 55 forks source link

Add shutdown route #496

Closed mwdomino closed 1 month ago

mwdomino commented 1 month ago

Howdy!

This PR adds a simple route /api/v1/admin/shutdown which cancels the App main context and shuts down the running gnmic server.

In our environment we run gnmic in k8s and have an in-memory datastore. When we detect that this datastore has failed/crashed for some reason we would like a way to signal gnmic to restart immediately to trigger resubscription/resync of all paths.

Let me know if you have any feedback on this or have another approach you'd recommend.

karimra commented 1 month ago

Thanks for the contribution. The expectation here is that the gNMIc container stops and it gets restarted by k8s ?

mwdomino commented 1 month ago

Yes, exactly. Just shutting down is good enough for us as we can rely on k8s to spawn a new pod.