Skip to content

chore: Describe RBAC rules, remove unnecessary rules#770

Merged
NickLarsenNZ merged 15 commits intomainfrom
chore/rbac-review
Apr 2, 2026
Merged

chore: Describe RBAC rules, remove unnecessary rules#770
NickLarsenNZ merged 15 commits intomainfrom
chore/rbac-review

Conversation

@NickLarsenNZ
Copy link
Copy Markdown
Member

@NickLarsenNZ NickLarsenNZ commented Mar 25, 2026

Part of stackabletech/issues#798

Note

This was initially generated by a coding assistant to see how well it can inspect code and review the RBAC rules. the changes will be properly checked before reviews are requested.

  • Document each rule
  • Check the docs make sense. Rewrite where necessary
  • Remove unnecessary permissions
  • Attach explanations to PR description
  • Run all tests
  • Split operator and product roles into separate files

Explanation

Operator ClusterRole ({fullname}-clusterrole)

Rule Action Reason
nodes (list, watch, get) Removed The operator never reads Node objects. Cluster domain detection uses nodes/proxy. The topology provider runs in product pods via hdfs-clusterrole-nodes, not the operator. The get was added in bc0d9a9 alongside rack awareness but belongs to the product ClusterRole.
pods Removed Operator never creates, reads, lists, or watches pods. Pods are managed by StatefulSets.
secrets Removed Operator never creates or manages Secrets. They appear in delete_orphaned_resources() but the operator never add()s them, so orphan cleanup finds nothing (framework silently skips on 403).
endpoints (both occurrences) Removed Operator never reads endpoints. The standalone rule was added in bc0d9a9 for rack awareness, but endpoint querying runs in product pods. Kubernetes auto-creates endpoints for Services.
update verb (everywhere) Removed All resource creation/update goes through SSA (apply_patch). update = HTTP PUT = api.replace(), which is never called anywhere in the operator source.
watch on serviceaccounts Removed Controller does not .own() or .watches() ServiceAccounts.
watch on rolebindings Removed Controller does not .own() RoleBindings.
watch on poddisruptionbudgets Removed Controller does not .own() PodDisruptionBudgets.
batch/jobs Removed entirely Operator never creates Jobs. Boilerplate from the original template.
patch on hdfsclusters Removed Operator only patches the /status subresource via client.apply_patch_status(). The main resource is never patched directly.
list on listeners Removed Operator never add()s Listeners — they are managed by the listener-operator. Orphan cleanup finds nothing; get alone suffices for namenode_listener_refs.
get, update, list, watch on clusterrolebindings Removed The nodes controller patches this ClusterRoleBinding with a single SSA api.patch() call. No prior GET is needed; SSA only requires create + patch.
Comments added Documentation Added comments to all rules explaining their purpose.
get for customresourcedefinitions Remove Never used
bind for clusterroles Add for clusterrole-nodes Not sure how this worked before, but tests failed until I added it

Product ClusterRole (hdfs-clusterrole)

Rule Action Reason
get for configmaps, secrets, serviceaccounts Remove Product pods never need this
create, update for events Remove Product pods never need this, the operator does it
Comments added Documentation Added comments to all rules explaining their purpose.
get/list/watch for pods Add Was removed but seems needed due to a race-condition that will be fixed in a follow-up PR

Nodes ClusterRole (hdfs-clusterrole-nodes)

No rule changes. Added comments explaining the topology provider's needs for pods/nodes/endpoints and the listener lookup flow.

@NickLarsenNZ
Copy link
Copy Markdown
Member Author

--- PASS: kuttl/harness/cluster-operation_hadoop-latest-3.4.2_zookeeper-latest-3.9.4_openshift-false (268.13s)
--- PASS: kuttl/harness/kerberos_hadoop-3.4.2_zookeeper-latest-3.9.4_krb5-1.21.1_opa-1.12.3_kerberos-realm-CLUSTER.LOCAL_kerberos-backend-mit_openshift-false (1208.28s)
--- PASS: kuttl/harness/kerberos_hadoop-3.4.2_zookeeper-latest-3.9.4_krb5-1.21.1_opa-1.12.3_kerberos-realm-PROD.MYCORP_kerberos-backend-mit_openshift-false (1298.42s)
--- PASS: kuttl/harness/logging_hadoop-3.4.2_zookeeper-latest-3.9.4_openshift-false (679.85s)
--- PASS: kuttl/harness/orphaned-resources_hadoop-latest-3.4.2_zookeeper-latest-3.9.4_openshift-false (147.92s)
--- PASS: kuttl/harness/profiling_hadoop-3.4.2_zookeeper-latest-3.9.4_openshift-false (194.00s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-1_datanode-pvcs-2hdd-1ssd_listener-class-cluster-internal_openshift-false (189.66s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-1_datanode-pvcs-2hdd-1ssd_listener-class-external-unstable_openshift-false (171.19s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-1_datanode-pvcs-default_listener-class-cluster-internal_openshift-false (182.52s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-1_datanode-pvcs-default_listener-class-external-unstable_openshift-false (177.47s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-cluster-internal_openshift-false (840.60s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-2_datanode-pvcs-2hdd-1ssd_listener-class-external-unstable_openshift-false (226.63s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-2_datanode-pvcs-default_listener-class-cluster-internal_openshift-false (207.30s)
--- PASS: kuttl/harness/smoke_hadoop-3.4.2_zookeeper-3.9.4_zookeeper-latest-3.9.4_number-of-datanodes-2_datanode-pvcs-default_listener-class-external-unstable_openshift-false (233.71s)
--- PASS: kuttl/harness/topology-provider_hadoop-latest-3.4.2_zookeeper-latest-3.9.4_krb5-1.21.1_kerberos-backend-mit_openshift-false (379.76s)

@NickLarsenNZ NickLarsenNZ self-assigned this Mar 31, 2026
@NickLarsenNZ NickLarsenNZ moved this to Development: Waiting for Review in Stackable Engineering Mar 31, 2026
@NickLarsenNZ NickLarsenNZ marked this pull request as ready for review March 31, 2026 20:24
Co-authored-by: Nick <10092581+NickLarsenNZ@users.noreply.github.com>
@Techassi Techassi moved this from Development: Waiting for Review to Development: In Review in Stackable Engineering Apr 2, 2026
@NickLarsenNZ NickLarsenNZ added this pull request to the merge queue Apr 2, 2026
@NickLarsenNZ NickLarsenNZ moved this from Development: In Review to Development: Done in Stackable Engineering Apr 2, 2026
Merged via the queue into main with commit 6a1b062 Apr 2, 2026
12 checks passed
@NickLarsenNZ NickLarsenNZ deleted the chore/rbac-review branch April 2, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Development: Done

Development

Successfully merging this pull request may close these issues.

2 participants