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

Reload when config is updated #46

Open
jackiepg12 opened this issue Aug 23, 2019 · 7 comments
Open

Reload when config is updated #46

jackiepg12 opened this issue Aug 23, 2019 · 7 comments

Comments

@jackiepg12
Copy link

How to reload when the config is updated?

@braedon
Copy link
Owner

braedon commented Aug 26, 2019

Hi @jackiepg12, there's (currently) no support for reloading the config on the fly - either automatically or via a signal. The config is only read on startup, so if you need to modify it, you'll need to restart the exporter.

If you'd like to work on a config reload feature, I'd be happy to discuss how it might work?

@jonny-wg2
Copy link

@jackiepg12 best way to reload the config is just redeploy the exporter or kill the pod. This is pretty common with many apps when it comes to initializing config at runtime.

@opsforce
Copy link

@jackiepg12
if you use Kubernetes, maybe stakater-reloader can help you.

@jonny-wg2
Copy link

+2 on stakater-reloader . we have this and it works great

@braedon braedon mentioned this issue Apr 10, 2021
@xuanyuanaosheng
Copy link

@opsforce @jonny-wg2 Could you please give a example ?

@jonny-wg2
Copy link

jonny-wg2 commented Jun 4, 2021

The reloader docs will help.

But here you go, with the configmap name being es-exporter

apiVersion: apps/v1
kind: Deployment
metadata:
  name: es-exporter
  namespace: monitoring
  annotations:
    configmap.reloader.stakater.com/reload: "es-exporter"
    flux.weave.works/automated: "true"
spec:

@ntavares
Copy link

ntavares commented Jan 6, 2022

@braedon I think this definitely a plus. I had this requirement today, and had a look at the code. Shouldn't be too hard to implement, if I get around at learning how to reset the scheduler from scratch. I'm wondering if you have any thoughts on the best way forward?

Currently, this is what I'm doing:

  • I have an initContainer with kiwigrid/k8s-sidecar (quick reading through stakater-reloader doesn't seem to be able to save the files?) which will dump all relevant configmaps into a folder (config-dir);
  • Then the prometheus-es-exporter starts, and it will handle errors via PR When using config-dir (multiple files), do not break if one introduces parsing errors. #98
  • Together with the exporter, I keep a sidecar (also kiwigrid/k8s-sidecar) monitoring for changes, and when there are changes, it triggers a pod restart;

So far, seems to work well.... but it's definitely more convoluted than a simple SIGHUP or dnotify...

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

6 participants