argoproj / argo-cd

Declarative Continuous Deployment for Kubernetes
https://argo-cd.readthedocs.io
Apache License 2.0
16.92k stars 5.14k forks source link

Auto refresh doesn't work, but manual hard-refresh does #10329

Open shturcite opened 1 year ago

shturcite commented 1 year ago

Checklist:

Describe the bug ArgoCD doesn't refresh the deployed applications on it's own and never pulls down latest changes from the Harbor Helm repo. If we however do hard-refresh via UI or CLI then it immediately notices the changes and shows the app as out of sync along with the diff.

To Reproduce ArgoCD is installed via Helm, with defaults mostly and without much custom config. Tried adding my values.yaml, but it was too big.

  1. Deploy ArgoCD via the Helm chart
  2. Add private Helm repository and push your chart to it
  3. Create new ArgocD application via K8s manifest or UI that points to the chart in the private repo
  4. Deploy the application to ArgoCD, it gets deployed successfully
  5. Modify some of the templates or the values file of the chart and push to the private repo
  6. Wait for ArgoCD to do auto refresh and notice the changes, it never does
  7. Do hard refresh via CLI or UI and it immediately notices the changes
    • Changing the chart version in Chart.yaml before push to the Helm repo and then updating the TargetRevision to the same version in the ArgoCD application doesn't pull the other chart changes. It only notices the version diff.

Expected behavior

Auto refresh works as specifiled by the timeout.reconciliation: value

Screenshots

Version

argocd version                                                                                                                                                                                                                                                                                 test-k8s/argocd
argocd: v2.4.8+844f79e.dirty
  BuildDate: 2022-07-29T18:43:01Z
  GitCommit: 844f79eb9d8f3ab96d4ce6f8df211c6093a660ba
  GitTreeState: dirty
  GoVersion: go1.18.4
  Compiler: gc
  Platform: linux/amd64
WARN[0000] Failed to invoke grpc call. Use flag --grpc-web in grpc calls. To avoid this warning message, use flag --grpc-web.
argocd-server: v2.4.9+1ba9008
  BuildDate: 2022-08-11T15:22:41Z
  GitCommit: 1ba9008536b7e61414784811c431cd8da356065e
  GitTreeState: clean
  GoVersion: go1.18.5
  Compiler: gc
  Platform: linux/amd64
  Kustomize Version: v4.4.1 2021-11-11T23:36:27Z
  Helm Version: v3.8.1+g5cb9af4
  Kubectl Version: v0.23.1
  Jsonnet Version: v0.18.0

Logs

Please let me know whose deployment logs you need.
shturcite commented 1 year ago

I am playing with combinations of those options in an attempt to make it work but still remain unsuccessful:

image

And yes, I am aware of the anti-pattern of such a short cache. This is only me trying to make it work. Afterwards I'll tweak and optimise it accordingly.

Another ugly hack is to trigger hard refresh via API or CLI calls to ArgoCD during CI deploys.

ashutosh16 commented 1 year ago

Can you try adding this annotation argocd.argoproj.io/refresh: hard? And does this solve your use case? https://github.com/argoproj/argo-cd/blob/cc4eea0d6951f1025c9ebb487374658186fa8984/pkg/apis/application/v1alpha1/application_annotations.go#L6

shturcite commented 1 year ago

Yes, this works even though it would have been nice if ArgoCD could do this automatically on a configurable time internval when used with private Helm repo.

rshiva777 commented 12 months ago

Can you try adding this annotation argocd.argoproj.io/refresh: hard? And does this solve your use case?

https://github.com/argoproj/argo-cd/blob/cc4eea0d6951f1025c9ebb487374658186fa8984/pkg/apis/application/v1alpha1/application_annotations.go#L6

This doesnt fix the issue. Still argocd application is unable to fetch the new secret from secret manager. It works only when i do hard refresh

amirsalaar commented 4 months ago

I have a similar issue with v2.10.1+a79e0ea version.

I have set the helm repo for the application. When pushing new charts to the helm repository, I expect ArgoCD to pull the changes every 3 minutes by default, which it doesn't.

I can only get new resourced created and auto-synced when I press HARD REFRESH.

Is there any solution to fix this issue to have ArgoCD watching for changes in the helm reposity for the specified chart and on new manifest publish it sync the applications?