@@ -6,6 +6,7 @@ metadata:
66 labels :
77 {{- include "operator.labels" . | nindent 4 }}
88rules :
9+ # For automatic cluster domain detection
910 - apiGroups :
1011 - " "
1112 resources :
@@ -20,59 +21,64 @@ rules:
2021 - nodes/proxy
2122 verbs :
2223 - get
24+ # Manage core workload resources created per HiveCluster.
25+ # All resources are applied via Server-Side Apply (create + patch) and tracked for
26+ # orphan cleanup (list + delete). get is also needed for the ReconciliationPaused strategy.
27+ # ConfigMaps and Services are watched by the controller (.owns()) so they also need watch.
28+ # - configmaps: role group configuration and discovery ConfigMaps
29+ # - services: headless and metrics Services per role group
2330 - apiGroups :
2431 - " "
2532 resources :
26- - pods
2733 - configmaps
28- - secrets
2934 - services
30- - endpoints
31- - serviceaccounts
3235 verbs :
3336 - create
3437 - delete
3538 - get
3639 - list
3740 - patch
38- - update
3941 - watch
42+ # ServiceAccount created per cluster instance by build_rbac_resources.
43+ # Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
4044 - apiGroups :
41- - rbac.authorization.k8s.io
45+ - " "
4246 resources :
43- - rolebindings
47+ - serviceaccounts
4448 verbs :
4549 - create
4650 - delete
4751 - get
4852 - list
4953 - patch
50- - update
51- - watch
54+ # RoleBinding created per cluster instance by build_rbac_resources, binding the
55+ # product ClusterRole to the per-cluster ServiceAccount.
56+ # Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
5257 - apiGroups :
53- - apps
58+ - rbac.authorization.k8s.io
5459 resources :
55- - statefulsets
60+ - rolebindings
5661 verbs :
57- - get
5862 - create
5963 - delete
64+ - get
6065 - list
6166 - patch
62- - update
63- - watch
67+ # StatefulSet created per role group. Applied via SSA and tracked for orphan cleanup.
68+ # Watched by the controller (.owns()).
6469 - apiGroups :
65- - batch
70+ - apps
6671 resources :
67- - jobs
72+ - statefulsets
6873 verbs :
6974 - create
7075 - delete
7176 - get
7277 - list
7378 - patch
74- - update
7579 - watch
80+ # PodDisruptionBudget created per role for availability guarantees.
81+ # Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
7682 - apiGroups :
7783 - policy
7884 resources :
8389 - get
8490 - list
8591 - patch
86- - update
87- - watch
8892 - apiGroups :
8993 - apiextensions.k8s.io
9094 resources :
@@ -100,28 +104,32 @@ rules:
100104 - list
101105 - watch
102106 {{- end }}
107+ # For emitting Kubernetes events during reconciliation.
103108 - apiGroups :
104109 - events.k8s.io
105110 resources :
106111 - events
107112 verbs :
108113 - create
109114 - patch
115+ # Watch HiveCluster objects (the primary CRD) and read them during reconciliation.
116+ # get is also needed for the ReconciliationPaused strategy.
110117 - apiGroups :
111118 - {{ include "operator.name" . }}.stackable.tech
112119 resources :
113120 - {{ include "operator.name" . }}clusters
114121 verbs :
115122 - get
116123 - list
117- - patch
118124 - watch
125+ # For patching the status subresource of HiveCluster objects via apply_patch_status.
119126 - apiGroups :
120127 - {{ include "operator.name" . }}.stackable.tech
121128 resources :
122129 - {{ include "operator.name" . }}clusters/status
123130 verbs :
124131 - patch
132+ # Read S3Connection objects to configure the metastore's S3 storage.
125133 - apiGroups :
126134 - s3.stackable.tech
127135 resources :
@@ -130,6 +138,7 @@ rules:
130138 - get
131139 - list
132140 - watch
141+ # Bind the product ClusterRole to per-cluster ServiceAccounts.
133142 - apiGroups :
134143 - rbac.authorization.k8s.io
135144 resources :
@@ -138,17 +147,18 @@ rules:
138147 - bind
139148 resourceNames :
140149 - {{ include "operator.name" . }}-clusterrole
150+ # Listener resource created per role for load balancer / NodePort access.
151+ # Applied via SSA and tracked for orphan cleanup. Not watched by the controller.
141152 - apiGroups :
142153 - listeners.stackable.tech
143154 resources :
144155 - listeners
145156 verbs :
157+ - create
158+ - delete
146159 - get
147160 - list
148- - watch
149161 - patch
150- - create
151- - delete
152162---
153163apiVersion : rbac.authorization.k8s.io/v1
154164kind : ClusterRole
@@ -157,6 +167,8 @@ metadata:
157167 labels :
158168 {{- include "operator.labels" . | nindent 4 }}
159169rules :
170+ # Workload pods need to read their own ConfigMaps (configuration), Secrets (credentials,
171+ # TLS certs), and ServiceAccount tokens at runtime.
160172 - apiGroups :
161173 - " "
162174 resources :
@@ -165,6 +177,7 @@ rules:
165177 - serviceaccounts
166178 verbs :
167179 - get
180+ # For workload pods to emit Kubernetes events.
168181 - apiGroups :
169182 - events.k8s.io
170183 resources :
@@ -173,6 +186,7 @@ rules:
173186 - create
174187 - patch
175188{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
189+ # Required on OpenShift to allow the workload pods to run as non-root.
176190 - apiGroups :
177191 - security.openshift.io
178192 resources :
0 commit comments