In ArgoCD, if you try to add/update some object that already exists, you my receive an error as follows:
Unable to connect repository: existing repository spec is different; use upsert flag to force update.
If you try to create/update an existent application, cluster or any other object you will receive the similar error.
Cool Tip: ArgoCD’s “FATA[0005] Unauthenticated” error resolution! Read more →
Use Upsert Flag to Force Update in ArgoCD
From these error messages it is not completely clear how exactly should the upsert flag be added to force the update.
Especially if the error pop-ups in an ArgoCD user interface.
To force the object update, it is required to login to the ArgoCD server from a command-line and execute the appropriate argocd command with the --upsert flag as follows:
$ argocd <command> --upsert - example - $ argocd cluster add k8s-cluster-0 --namespace argocd-apps --upsert - sample output - Cluster 'https://k8s-cluster-0.infra:443' added
The argocd command above with the --upsert flag will force the ArgoCD object creation without displaying the error.