Multiple ArgoCD deployments attempt to reconcile the same ApplicationSet despite ARGOCD_APPLICATIONSET_CONTROLLER_NAMESPACES being set to mutually exclusive namespaces #21219
Labels
bug
Something isn't working
component:application-sets
Bulk application management related
version:2.12
Latest confirmed affected version is 2.12
Checklist:
argocd version
.Describe the bug
I have two ArgoCD deployments in the same cluster configured as cluster-wide instances. To ensure that they manage mutually exclusive sets of Applications/ApplicationSets I have set the
ARGOCD_APPLICATIONSET_CONTROLLER_NAMESPACES
andARGOCD_APPLICATION_NAMESPACES
environment variables in the relevant controllers (as described here and here), such that each instance should monitor apps/appsets in mutually exclusive sets of namespaces.I am deploying an ApplicationSet into a namespace monitored by the first ArgoCD instance whose generated Applications use an AppProject only known to that instance.
What I am finding is that the ApplicationSet's status flip-flops between being Healthy and being Degraded, showing the error message: "error getting project dh-applications-dev: AppProject.argoproj.io "dh-applications-dev" not found". I can see the same error message in the container logs of the appset controller of the instance that shouldn't be managing this appset
To Reproduce
applicationsetcontroller.namespaces
andapplication.namespaces
(in the Helm values underconfigs.params
) both to*-dev,dev-argocd-seed-manifests
.*-prd,prd-argocd-seed-manifests,*-ppr,ppr-argocd-seed-manifests
.dh-applications-dev
.dh-applications-dev
project and deploy it in a namespace which should be covered by the first ArgoCD instance, egsometeam-applications-dev
.Expected behavior
The ApplicationSet in a namespace should be ignored by the appset controller which is not monitoring that namespace.
Version
v2.12.6+4dab5bd
My guess as to what is wrong
I notice that the
ignoreNotAllowedNamespaces
predicate (here) which is used by the controller only applies the namespace filter to create events.Could it be that when the first ArgoCD instance, after reacting to the create event, updates the status thus triggering an update event, which now both instances will react to? The second instance would then update the status to indicate the error state (because it doesn't know about the AppProject). That triggers a subsequent update event, the first instance reacts to this and puts the status back to healthy, and so on.
Should the
ignoreNotAllowedNamespaces
predicate not apply the filter to all types of event, eg using the NewPredicateFuncs method?The text was updated successfully, but these errors were encountered: