Repository navigation
feat(rbac): WorkloadGroup 소유자 기반 update/delete 권한 (AIP-3518) - #128
Merged
Merged
Conversation
같은 namespace 의 WorkloadGroup(aipub.ten1010.io/v1alpha1, namespaced)에 대해 모든 프로젝트 멤버가 create/get/watch/list 가능하도록 project Role 규칙을 추가하고, 수정/삭제(update/patch/delete)는 생성자 본인(AipubUser per-user Role, resourceName 단위) 또는 project manager(*)에게만 부여한다. FileServer(#110)와 동일한 계약이다. - ProjectApiConstants: workloadgroups kind/plural 상수 추가 - V1alpha1WorkloadGroup(+List) DTO, K8sApiProvider/informer 등록 - reconcileProjectRoleRules: MANAGER `*` / DEVELOPER BASIC_VERBS 규칙 추가 - AipubUserRoleReconciler: per-user 소유 워크로드 목록에 workloadgroups 포함 - WorkloadResourceResolver: WorkloadGroup → workloadgroups 매핑 + instanceof 폴백 - WorkloadGroup watch wiring (OnUpdateFilter/RequestBuilder/ControllerFactory) - 단위 테스트 11건 추가 (Role 규칙 6건, 소유자 이전 watch 5건) 소유자 라벨은 user-v2 mutating webhook 이 namespaced CREATE 에 주입하므로 웹훅 rule 변경은 없다. 컨트롤러 ClusterRole 은 와일드카드라 인포머 권한도 그대로다. DTO 는 metadata 만 담아 CRD 스키마에 의존하지 않는다. 검증: ./gradlew build — 전체 56 스위트 통과 Refs: AIP-3518 Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
*, 수정/삭제는 생성자 본인의 AipubUser Role 에 resourceName 단위로만 부여Changes
ProjectApiConstants에 workloadgroups kind/plural 추가,V1alpha1WorkloadGroup(+List)신규 (metadata 만 담아 CRD 스키마 비의존)K8sApiProvider에 GenericKubernetesApi,SharedInformerFactoryProvider에 namespace 인덱서 인포머 등록ReconciliationService.reconcileProjectRoleRules에 manager*/ developer BASIC_VERBS 규칙 추가,WorkloadResourceResolver에 kind 매핑 + instanceof 폴백AipubUserRoleReconcilerper-user 워크로드 목록에 workloadgroups 포함,AipubUserRoleControllerFactoryreadyFunc/watch 연결,OnUpdateFilterFactory/RequestBuilderFactory필터·요청 빌더 추가ReconciliationServiceWorkloadGroupRulesTest6건,WorkloadGroupOwnerTransferWatchTest5건웹훅 rule·컨트롤러 ClusterRole 은 변경 없음 — namespaced CR 은 기존
aipub.ten1010.io*rule 이 커버하고, 컨트롤러 ClusterRole 은 와일드카드🔍 여기만은 꼭 봐주세요
ReconciliationServicedeveloper 분기의 workloadgroups 규칙이BASIC_VERBS인지 — 여기에 update/delete 가 들어가면 같은 프로젝트의 다른 멤버가 남의 WorkloadGroup 을 지울 수 있다WorkloadResourceResolver의instanceof V1alpha1WorkloadGroup폴백 — 인포머 list 단계에서 kind 가 비어 오는 경우 per-user Role 규칙이 누락되지 않게 하는 장치Test plan
./gradlew compileJava compileTestJava testkubectl get role -n <proj> -o yaml | grep -A3 workloadgroups로 developer 는 create/get/watch/list, manager 는*확인kubectl auth can-i delete workloadgroups/<name> -n <proj> --as=oidc:<user>가 본인은 yes, 다른 developer 는 noaipub.ten1010.io/username라벨을 다른 사용자로 바꾼 뒤 구 소유자의 delete 가 즉시 no 로 바뀌는지 확인🚀 Release Version
v5.2.0