Reloader
Reloader copied to clipboard
reload-on-create trigger rollingupdate of all deployments if Reloader pod restart
If I start Reloader with the "--reload-on-create=true" argument, everytime reloader pod is restarted it triggers a rolling update of all deployment that are "managed" by Reloader.
Example of Reloader logs after a restart:
time="2022-03-25T14:24:19Z" level=info msg="Environment: Kubernetes"
time="2022-03-25T14:24:19Z" level=info msg="Starting Reloader"
time="2022-03-25T14:24:19Z" level=warning msg="KUBERNETES_NAMESPACE is unset, will detect changes in all namespaces."
time="2022-03-25T14:24:19Z" level=info msg="Starting Controller to watch resource type: secrets"
time="2022-03-25T14:24:19Z" level=info msg="Starting Controller to watch resource type: configMaps"
time="2022-03-25T14:24:20Z" level=info msg="Changes detected in 'nginx' of type 'CONFIGMAP' in namespace 'default'"
time="2022-03-25T14:24:20Z" level=info msg="Updated 'nginx-auto' of type 'Deployment' in namespace 'default'"
time="2022-03-25T14:24:20Z" level=info msg="Changes detected in 'nginx' of type 'CONFIGMAP' in namespace 'default'"
time="2022-03-25T14:24:20Z" level=info msg="Updated 'nginx-search' of type 'Deployment' in namespace 'default'"
I don't think it is an expected behaviour.
This is a known issue, this tool has been designed to reload based on any change. The ability to reload based on new resource (secret/configmap) addition is optional and limited. The Kubernetes API return all the resources as new resources at the start and there isn't a way to check which resource was created with different content. So that's why the issue happens. We welcome any suggestions and also accept the contributions via PRs in case you have ideas for how to fix this :)
It is not possible to trigger rolling update on create/update events that occurs only after the Reloader's pod has started ?
We welcome any suggestions and also accept the contributions via PRs in case you have ideas for how to fix this :)
Assuming --reload-strategy=annotations
, shouldn't it be possible to compare the new hash against the hash in the reloader.stakater.com/last-reloaded-from
annotation, and only trigger a rolling update if they differ?
@faizanahmad055 is it still the case or could you please tell me any plan to implement this in new releases ?
This should be fixed now. When reloader restarts it no longer automatically restarts the pods it is watching.