improve: sync script to detect if prune required before syncing #103
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR improves the
sync_argocd_apps.sh
script so that it detects if resources need to be pruned before syncing, rather than doing a sync, and seeing if it throws a warning that resources require pruning.We do this by additionally checking if there are any resources with
requiresPruning: true
when we get the status of the ArgoCD apps, and only prompting the user to prune there if there is at least one. We also print the list of resources that need to be pruned, to help the user decide.WARNING: DO NOT MERGE until argoproj/argo-cd#17188 is resolved
Note, we could work-around the upstream ArgoCD issue by looping over each resource that "requires pruning", and check if it has the
argocd.argoproj.io/sync-options: Prune=false
annotation.However, this approach has two significant problems:
kubectl
context with permission toget
on pretty much every resource in the cluster.get
requests, one for each resource that ArgoCD thinks needs to be pruned (which will increase for some deployKF apps with the number of users, as we replicate resources like Secrets for each profile).