Describe the bug
If the ApiServer fails to list Custer Secrets All applications are deleted ( and undeployed from target clusters if not set preserveResourcesOnDeletion)
To Reproduce
Create an ApplicationSet with ClusterGenerator, eg:
---
apiVersion: argoproj.io/v1alpha1
kind: ApplicationSet
metadata:
name: rancher-monitoring
namespace: argocd
spec:
generators:
- clusters:
selector:
matchLabels:
environment: production
values:
revision: release-1.0
- clusters:
selector:
matchLabels:
environment: test
values:
revision: HEAD
- clusters:
selector:
matchLabels:
environment: development
values:
revision: development
template:
metadata:
name: '{{nameNormalized}}-rancher-monitoring'
Expected behavior
Applications are not deleted if error occurs listing clusters, deletion shall occur only if the cluster list is empty.
Logs of error listing ARGOCD Clusters from argocd-applicationset-controller
app_kubernetes_io_name argocd-applicationset-controller
cluster loki
container argocd-applicationset-controller
filename /var/log/pods/argocd_argocd-applicationset-controller-657d5cc4fd-759g5_6cab55c6-afc4-47eb-8c3c-058b21d99277/argocd-applicationset-controller/0.log
job argocd/argocd-applicationset-controller-
namespace argocd
pod argocd-applicationset-controller-657d5cc4fd-759g5
pod_template_hash 657d5cc4fd
Detected fields
Time 1717335771666
log "time=\"2024-06-02T13:42:51Z\" level=error msg=\"error generating application from params\" applicationset=argocd/rancher-monitoring error=\"error listing clusters: the server was unable to return a response in the time allotted, but may still be processing the request (get secrets)\" generator=\"{nil &ClusterGenerator{Selector:{map[environment:production] []},Template:ApplicationSetTemplate{ApplicationSetTemplateMeta:ApplicationSetTemplateMeta{Name:,Namespace:,Labels:map[string]string{},Annotations:map[string]string{},Finalizers:[],},Spec:ApplicationSpec{Source:nil,Destination:ApplicationDestination{Server:,Namespace:,Name:,},Project:,SyncPolicy:nil,IgnoreDifferences:[]ResourceIgnoreDifferences{},Info:[]Info{},RevisionHistoryLimit:nil,Sources:[]ApplicationSource{},},},Values:map[string]string{revision: release-1.0,},} nil nil nil nil nil nil nil nil}\"\n"
stream "stderr"
time "2024-06-02T13:42:51.570707233Z"
tsNs 1717335771666269049
Logs of deletion from argocd-notifications-controller ( one per target cluster )
Checklist:
argocd version
.Describe the bug If the ApiServer fails to list Custer Secrets All applications are deleted ( and undeployed from target clusters if not set preserveResourcesOnDeletion)
To Reproduce
Create an ApplicationSet with ClusterGenerator, eg:
Expected behavior Applications are not deleted if error occurs listing clusters, deletion shall occur only if the cluster list is empty.
Screenshots
Version
Logs
Logs of error listing ARGOCD Clusters from argocd-applicationset-controller
Logs of deletion from argocd-notifications-controller ( one per target cluster )
Logs of recreation from argocd-notifications-controller ( one per target cluster )