Disabling in-cluster does not prevent the usage of in-cluster #21207
Labels
bug
Something isn't working
component:api
API bugs and enhancements
component:application-controller
good first issue
Good for newcomers
security
Security related
Milestone
Describe the bug
When disabling the in-cluster via
cluster.inClusterEnabled: 'false'
, the cluster is properly not showing from the Argo CD cluster list. However, Argo CD can still sync existing applications using this cluster and create resources on the in-cluster if it has k8s permissions via RoleBindings. Furthermore, applications can still be created using https://kubernetes.default.svc cluster url.See the missing validation on
inClusterEnabled
usage in https://github.com/agaudreault/argo-cd/blob/0074bb4b486312e552f96f325f26148b3bbabbc0/util/db/cluster.go#L228-L230.Another impact of this is that the controller will start to watch all resources on the local cluster when
inClusterEnabled=false
and no "in-cluster" secret exist, because the liveStateCache callsc.db.GetCluster
, which returns the local cluster with default configuration. The cluster watches also do not handle the in-cluster secret to be disabled, so it will never be removed from the watches.The usage of variable
KubernetesInternalAPIServerAddr
should be analyzed and probably the settings should be checked too when necessary in other code paths.To Reproduce
cluster.inClusterEnabled: 'false'
and deleted the in-cluster secret.Expected behavior
https://kubernetes.default.svc
is disabled" when an Application is created/updated.Version
Latest master (2.13.1)
The text was updated successfully, but these errors were encountered: