Open kklimonda opened 4 years ago
@kklimonda same here in the end i added in my deploymet/statefullset
{{- if .Values.annotations }} annotations: {{ toYaml .Values.annotations | indent 4 }} {{- end }}
to please argocd i.e workaround
Is there any option to disable such verification mechanism for all resources in argocd?
Using 2.2.x and now 2.3.2 several of my applications are showing as out-of-sync because of the restart annotation.
This seems to affect all my deployments that have an empty annotations in the desired manifest
template:
metadata:
annotations: {}
producing a diff like
I was able to solve it by deleting and re-creating the argo application with all it's resources
I was able to solve it by deleting and re-creating the argo application with all it's resources
you mean ... including the deployments, pods, services etc? Or just the argocd application resource? I don't want to cause downtime, just to remove some diff
In the meantime I tried adding a ignore spec
ignoreDifferences:
- group: apps
kind: Deployment
jqPathExpressions:
- .spec.template.metadata.annotations."kubectl.kubernetes.io/restartedAt"
which ended up looking like this
Removing the annotations: {}
from desired manifest, with and without the above ignore spec had no impact.
The only way I found to get rid of it, without causing downtime of my deployment, is to manually edit the live manifest
This worked for me in argocd-cm config map.
data:
resource.customizations.ignoreDifferences.apps_Deployment: |
jqPathExpressions:
- .spec.template.metadata.annotations."kubectl.kubernetes.io/restartedAt"
- if (.spec.template.metadata.annotations | length) == 0 then .spec.template.metadata.annotations else empty end
See here how patching works. It's done in a loop with del(<your jq path expression here>)
.
We do seemingly have the same issue. Any workarounds other than deleting the resource ? How the resource gets into this state ?
this annotation added by kubectl - objectrestarter.go
It looks like a bug for me, because I could manually remove this annotation from Deployment / DaemonSet, although it causes another restart.
@mnacharov May I know if there will be a PR for this? Thanks very much.
this doesn't seem to work for me. Its still showing a diff on the annotation:
I'm frequently getting this same restartedAt issue. Anyone manage to fix it reliably?
Removing empty annotations: {}
fixed it :+1:
Argocd v2.7.8+92949f6.dirty
here.
Doesn't matter if the empty annotations: {}
is present or not, the app stays out of sync with the following diff:
@ragnarpa's solution is working for me, with one modification: using keys | length
on the second expression. Otherwise it seems to be ignoring all annotations, I imagine because annotations
is not a list and length is always returning zero?
I'm using the following configuration:
resource.customizations.ignoreDifferences.all: |
jqPathExpressions:
- .spec.template.metadata.annotations."kubectl.kubernetes.io/restartedAt"
- if (.spec.template.metadata.annotations | keys | length) == 0 then .spec.template.metadata.annotations else empty end
@ragnarpa's solution is working for me, with one modification: using
keys | length
on the second expression. Otherwise it seems to be ignoring all annotations, I imagine becauseannotations
is not a list and length is always returning zero?I'm using the following configuration:
resource.customizations.ignoreDifferences.all: | jqPathExpressions: - .spec.template.metadata.annotations."kubectl.kubernetes.io/restartedAt" - if (.spec.template.metadata.annotations | keys | length) == 0 then .spec.template.metadata.annotations else empty end
both solutions seems to give the same result: https://jqlang.github.io/jq/manual/#length
Checklist:
argocd version
.Describe the bug
Our manifests by default have empty metadata annotations (see https://gitlab.cloudferro.com/kklimonda/argocd-bug-report.git for the code example). When initially deployed on the cluster, apps are reported as
Synced/Healthy
but once annotation is modified out-of-band (e.g. viakubectl rollout restart
status changes toOutOfSync/Healthy
and cannot be converted toSynced/Healthy
via sync anymore.Furthermore the manifest diff is wrong: CLI shows no diff at all, and WebUI diff doesn't match the manifest (see screenshots).
To Reproduce
Expected behavior
Firstly, given that
kubectl.kubernetes.io/restartedAt
can be added by ArgoCD itself, perhaps that particular annotation should be ignored by default? Secondly, I'd expect sync to drop that annotation to converge application toSynced/Healthy
state.Screenshots
Version
Logs