Fix per-namespace RBAC collisions across Argo CD instances and controllers

Offen
#1,521 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
5/5
Geschätzter Aufwand
Über eine Woche
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
go, kubernetes

Rechercherichtung

Read argocd-operator/controllers/argocd/image_updater.go, role.go, and rolebinding.go, then trace source namespace cleanup and ApplicationSet reconciliation. Map how Image Updater and application source namespace RBAC create, reconcile, and remove overlapping resources. Done means the listed collision, upgrade, interruption, and cleanup scenarios are covered by tests while preserving active permissions and removing confirmed stale grants.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Summary

Per-namespace RBAC resources for Image Updater can collide with resources managed by another Argo CD instance or by application source namespace reconciliation. These collisions can cause controllers to overwrite each other's RBAC state or remove permissions that are still needed.

Scenarios

  1. Same-named Argo CD instances: Two instances in different namespaces watch the same target namespace and use the same per-namespace Role and RoleBinding names. After a failed or interrupted reconciliation, a Role can carry instance A's owner label while its RoleBinding grants access to instance B. When A prunes the namespace, it can delete the Role and remove B's manager permissions.
  2. Role collision with applications in any namespace: Image Updater calls newRoleForApplicationSourceNamespaces, which is also used for application source namespace RBAC. When the scopes overlap, Image Updater and the application controller can reconcile the same Role with different rules.
  3. RoleBinding collision with applications in any namespace: Image Updater calls newRoleBindingForSupportNamespaces, which is also used for application source namespace RBAC. When the scopes overlap, Image Updater and the application controller can reconcile the same RoleBinding with different subjects or Role references.

Required work

Provide a general solution that isolates per-namespace RBAC by component and Argo CD instance. Consider distinct resource names that include the component and instance namespace. Alternatively, evaluate Image Updater-specific ownership marks and changes to application and ApplicationSet reconciliation, including how they avoid same-name Kubernetes object collisions.

Handle existing shared resources during upgrade. Preserve active permissions while migrating, and remove stale grants without deleting resources still needed by another instance or component.

Affected areas include argocd-operator/controllers/argocd/image_updater.go, argocd-operator/controllers/argocd/role.go, argocd-operator/controllers/argocd/rolebinding.go, and source namespace cleanup.

Acceptance criteria

  • Same-named instances can reconcile and prune overlapping target namespaces without overwriting or removing each other's required RBAC.
  • Image Updater and application source namespace RBAC can coexist without conflicting Role rules or RoleBinding subjects and references. Check ApplicationSet reconciliation as well.
  • Cleanup preserves Roles referenced by another instance's active RoleBinding and still removes confirmed stale orphaned resources.
  • Upgrade and interrupted-reconciliation paths preserve needed access and do not leave stale grants.
  • Tests cover the three scenarios, overlapping scopes, upgrade, interruption, and cleanup.

Requested by @dkarpele.

PR: https://github.com/redhat-developer/gitops-operator/pull/1511
Review finding: https://github.com/redhat-developer/gitops-operator/pull/1511#discussion_r4517295806
Related review comment: https://github.com/redhat-developer/gitops-operator/pull/1511#discussion_r4509278543

Vorherrschende Sprache
Go
Sterne
190
Forks
367
Ø Merge
4 T. 2 Std.
Gemergte PRs (30 T.)
63

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus redhat-developer/gitops-operator

Alle Issues in redhat-developer/gitops-operator

Ähnliche Issues

Weitere Issues zu Go

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.