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

未關閉
#1,521 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

還沒有人認領這個 Issue。

評估

難度
5/5
預估耗時
一週以上
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
go, kubernetes

研究方向

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.

由索引模型根據 Issue 內容生成。

描述

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

主要語言
Go
星號
190
分支
367
平均合併
4 天 2 小時
30 天內合併 PR
63

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

redhat-developer/gitops-operator 的其他 Issue

查看 redhat-developer/gitops-operator 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。