Detect drift when using kubectl edit and autosync is disabled #25952
Replies: 1 comment
|
You do not need auto-sync to detect this kind of drift. In Argo CD, comparison and synchronization are separate: with auto-sync disabled, a live edit should make the Application The minimal Application policy is therefore simply to leave automated sync disabled, for example: spec:
syncPolicy:
automated:
enabled: falseDo not enable https://argo-cd.readthedocs.io/en/stable/user-guide/auto_sync/ A practical workflow is: # Force a status comparison and show the result
argocd app get my-app --refresh
argocd app diff my-app
# If the live edit is rejected, restore Git's desired state manually
argocd app sync my-appIf the live edit is accepted, Argo CD does not provide a safe general-purpose "reverse sync to Git" operation. Export/diff the intended fields, update the manifest or Helm/Kustomize input in Git, and let the next comparison return to If a
The important point is that a Kubernetes object's last-modified timestamp is not the desired-state source of truth. Argo compares the rendered Git manifests with the cached live Kubernetes resource. A normal field change should therefore be visible even when the Git revision did not change. If this solves the issue, please mark it as the accepted answer so future readers can find the workflow easily. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
I work with people who are stuck in their ways. They refuse to stop using kubectl edit or lens to make changes. We also don't want resources to be autosynced. Instead they want to see the drift and if the drift is good, update git to match the change, or if they don't like the change, then sync with the current git data.
What are the combination of settings that we need so that we can ensure that argoCD uses the current state of the resources in the cluster when polling every 2-3 minutes to look for changes, and not just relying on the last modified timestamp?
We are using ArgoCD version 3.0.x
All reactions