You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.
When syncing apps with the command argocd app sync <appname> --prune on applications that have resources with the annotation argocd.argoproj.io/sync-options: Prune=false and have resources to be pruned the argo command exits with error until the sync is successful.
After all the resources that should be pruned are deleted the command exits without error.
To Reproduce
Create an application with resources with the annotations argocd.argoproj.io/sync-options: Prune=false. The auto-sync is disabled
Make a change to remove a resource from the application (one that is suppose to be deleted by argo)
Run the command argocd.argoproj.io/sync-options: Prune=false from the console
The command will error until the resource disappears. The error message is FATA[0002] 1 resources require pruning
Expected behavior
The argocd command should not error if the resource that "requires pruning" needs to be ignored
which checks if any resource requires pruning without checking if it has the annotations. The fix should be to only count resources that should actually be pruned. Looking at the current code I do not see a way of figuring out in
if the resource is to be pruned or not except by the message on the sync which would be ignored (no prune). If you have a better solution and give me some tips I could open a PR.
The text was updated successfully, but these errors were encountered:
For those watching, this is still an issue as of ArgoCD v2.10.1.
This issue's true cause is the Application resource does not correctly populate status.resources to reflect that resources with argocd.argoproj.io/sync-options: Prune=false do not actually require pruning (see #17188), if we fix that issue, then this problem will be completely resolved.
This issue also causes the UI and argocd app get to display the wrong information about resources, saying they "require pruning" even if they have argocd.argoproj.io/sync-options: Prune=false.
There is a slight workaround until #17188 is resolved, which is to additionally annotate your resources with argocd.argoproj.io/compare-options: IgnoreExtraneous, which makes them not actually "part of the app" from ArgoCD's perspective (so not contributing to if an app is "out of sync").
Note that the argocd app sync only "fails" if the actual final state is "out of sync", which it won't be if all the requiresPruning=true apps are IgnoreExtraneous:
WARNING: this workaround ONLY works if you are using argocd.argoproj.io/sync-options: Prune=false because you are generating the resource outside of ArgoCD itself, if you are using it because you don't want ArgoCD to remove the resource, because sometimes your app contains that resource, and other times it does not, then you will need to push for #17188 to be fixed.
If you are trying to resolve an environment-specific issue or have a one-off question about the edge case that does not require a feature then please consider asking a question in argocd slack channel.
Checklist:
argocd version
.Describe the bug
When syncing apps with the command
argocd app sync <appname> --prune
on applications that have resources with the annotationargocd.argoproj.io/sync-options: Prune=false
and have resources to be pruned the argo command exits with error until the sync is successful.After all the resources that should be pruned are deleted the command exits without error.
To Reproduce
argocd.argoproj.io/sync-options: Prune=false
. The auto-sync is disabledargocd.argoproj.io/sync-options: Prune=false
from the consoleFATA[0002] 1 resources require pruning
Expected behavior
The argocd command should not error if the resource that "requires pruning" needs to be ignored
Version
I believe the problem lies in
argo-cd/cmd/argocd/commands/app.go
Line 1467 in 3fe924e
argo-cd/pkg/apis/application/v1alpha1/types.go
Line 918 in 3fe924e
ignored (no prune)
. If you have a better solution and give me some tips I could open a PR.The text was updated successfully, but these errors were encountered: