stakater / Reloader

A Kubernetes controller to watch changes in ConfigMap and Secrets and do rolling upgrades on Pods with their associated Deployment, StatefulSet, DaemonSet and DeploymentConfig – [✩Star] if you're using it!
https://docs.stakater.com/reloader/
Apache License 2.0
7.45k stars 493 forks source link

Changes during Leader Election #481

Open dqle opened 1 year ago

dqle commented 1 year ago

HI, I'm currently testing Reloader and I have a question regarding HA setup and changes during leader election. Right now, my setup is the following:

  1. A deployment with annotation secret.reloader.stakater.com/reload: test-secret
  2. A secret named test-secret
  3. Reloader with following config enabled:
    • HA with 3 replicas
    • ReloadOnCreate: True
    • syncAfterRestart: True

This is working normally. I got the pod to restart when updating the secret and on the creation of secret. However, when I delete a reloader leader pod to trigger leader election, and made a change to the secret / add the secret, my deployment pod did not get restarted during or after leader election took place.

However, after leader election, if I make any changes to test-secret, then it is working as normal.

From the README, this is in the ReloadOnCreate section:

If reloadOnCreate is set to true: If you are running Reloader in HA mode all workloads will have a rolling update performed when a new leader is elected.

If ReloadOnCreate is set to false: Updates to configMaps/Secrets that occur while there is no leader will not be picked up by the new leader until a subsequent update of the configmap/secret occurs. In the worst case the window in which there can be no leader is 15s as this is the LeaseDuration.

From my testing, changes during leader election does not get pick up. Is it a bug or am I doing something wrong?

Reloader version is v1.0.28

faizanahmad055 commented 1 year ago

You need to enable: syncAfterRestart

dqle commented 1 year ago

You need to enable: syncAfterRestart

syncAfterRestart is enabled