Repository navigation
feat: PM·PD ClusterRole 에 IBNetwork·SriovNodeState get 추가 (AIP-3631) - #130
Merged
Merged
Conversation
InfiniBand 화면(AIP-3537)에서 PM·PD 가 두 CR 조회에 403 을 받는다. 사용자별 ClusterRole 에 규칙이 없어 apiserver 가 거부한 것이다. - ibnetworks: resourceNames 를 프로젝트 이름으로 좁혀 get - sriovnodestates: resourceNames 를 바인딩 노드로 좁혀 get 둘 다 Cluster scope 라 list 는 resourceNames 로 좁혀지지 않는다. 주면 전 프로젝트의 배정과 전 노드의 장치 상태가 열려 get 만 준다. 이름은 프론트가 안다 - IBNetwork 는 프로젝트 이름, SriovNodeState 는 노드 이름이고, IB 노드 여부는 get 의 200/404 로 가른다. 바인딩 노드가 없으면 sriovnodestates 규칙을 넣지 않는다. 빈 resourceNames 는 RBAC 에서 전체 허용이라 전 노드가 열린다.
juu-n-oo
marked this pull request as ready for review
October 26, 2026 08:23
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
ibnetworks·sriovnodestates의get권한을 추가한다.aipub-admin만cluster-admin이라 Admin 만 통과하고, 사용자별 ClusterRole 에는 두 CR 규칙이 없었다.list는resourceNames로 좁혀지지 않는다. 주면 전 프로젝트의 배정과 전 노드의 장치 상태가 열리므로 이름으로 좁힌get만 준다. 이름은 프론트가 안다 — IBNetwork 는 프로젝트 이름, SriovNodeState 는 노드 이름이고, IB 노드 여부는get의 200/404 로 가른다.Changes
ReconciliationService#reconcileClusterRoleRules):nodeGpuUsages규칙 뒤, PM 전용 블록 앞에 두 규칙을 추가했다. PM·PD 동일하게verbs: ["get"]이고,ibnetworks는resourceNames를 프로젝트 이름으로,sriovnodestates는 바인딩 노드 이름들로 좁힌다. 메서드 시그니처는 그대로다(project·bindingNodes가 이미 인자).resourceNames가드): 바인딩 노드가 없으면sriovnodestates규칙을 넣지 않는다. RBAC 에서 빈resourceNames는 전체 허용이라, 그대로 두면 노드가 0개인 프로젝트의 PM·PD 에게 전 노드가 열린다. 기존nodes·nodegroups규칙이 같은 이유로 쓰는 가드를 따랐다.ProjectApiConstants):IB_NETWORK_RESOURCE_KIND/PLURAL,SRIOV_NODE_STATE_RESOURCE_KIND/PLURAL추가.ReconciliationServiceInfinibandRulesTest): 신규 5건 — 프로젝트 이름으로 좁힌 IBNetworkget, 바인딩 노드로 좁힌 SriovNodeStateget, 두 규칙이get외 verb 를 주지 않음, 바인딩 노드 0개면 SriovNodeState 규칙 생략, 반복 reconcile 결과 동일(reconcileExistingRole의List.equals비교 통과).Test plan
./gradlew compileJava compileTestJava testkubectl get clusterrole <PM·PD 사용자 ClusterRole> -o yaml—ibnetworks는resourceNames가 프로젝트 이름 1건,sriovnodestates는 바인딩 노드 목록, 둘 다verbs: [get]인지 확인kubectl auth can-i get ibnetworks/<프로젝트> --as=oidc:<PM 계정>→ yes /kubectl auth can-i list ibnetworks --as=oidc:<PM 계정>→ nokubectl auth can-i get sriovnodestates/<바인딩 노드> --as=oidc:<PD 계정>→ yes /<바인딩되지 않은 노드>→ no /list→ nokubectl auth can-i patch ibnetworks/<프로젝트> --as=oidc:<PM 계정>→ no (배정은 Admin 전용)sriovnodestatesresourceNames가 따라 갱신되고, 변경 없는 상태에서 반복 갱신되지 않는지 확인sriovnodestates규칙이 없는지 확인여기만은 꼭 봐주세요
resourceNames가드의 범위 — 이번에는sriovnodestates에만 넣었다. 같은 함정이 기존noderesources·gpuconfigs·nodegpuusages에 남아 있다(가드 없이withResourceNames(nodes)). 바인딩 노드가 0개인 프로젝트의 PM·PD 는 지금도 전 노드의 그 CR 들을 읽을 수 있다. 이번 티켓 범위 밖이라 건드리지 않았는데, 별도 티켓으로 끊을지 의견 부탁드린다.spec.vfs[].owner.name(다른 프로젝트 이름),spec.vfs[].pkey,nodeGuid·portGuid,spec.pfs[].bdf가 들어 있다. 정책서는 "다른 프로젝트 할당 {n}" 이라는 합계만 화면에 보이게 정하고 있어서,get을 주면 화면에 그리지 않더라도 API 로는 그보다 많은 정보가 보인다. 이번 작업은 이를 허용하는 선택이다. 더 좁히려면 IB operator 가IBNetwork.status.nodes[]에 집계 필드(total·otherProjects·unassigned)를 넣어 SriovNodeState 조회 자체를 없애는 방향이 대안이다.reconcileExistingRole이List.equals(순서 비교)로 갱신 여부를 판단한다. 위치를 옮기면 기존 ClusterRole 이 한 번 갱신된다.범위 밖 (후속)
resourceNames로 좁힐 수 없다. RBAC 으로는 풀 수 없고,IBNetwork.status에 SM 요약 필드를 넣거나 프로젝트 범위 API 가 필요하다.list→ 이름별get전환: 현재 프론트는fetchSriovNodeStates()·fetchIbNetworks()로 목록을 조회한다. 이 PR 만으로는 화면이 복구되지 않는다. FE 후속 티켓이 필요하다.🚀 Release Version
v5.2.0