Skip to content

Commit c850b4a

Browse files
committed
chore: Describe RBAC rules, remove unnecessary rules
1 parent 9f1c4dc commit c850b4a

1 file changed

Lines changed: 50 additions & 32 deletions

File tree

  • deploy/helm/zookeeper-operator/templates

deploy/helm/zookeeper-operator/templates/roles.yaml

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,37 +6,44 @@ metadata:
66
labels:
77
{{- include "operator.labels" . | nindent 4 }}
88
rules:
9+
# For automatic cluster domain detection via the local kubelet configz endpoint.
910
- apiGroups:
1011
- ""
1112
resources:
12-
- nodes
13+
- nodes/proxy
1314
verbs:
14-
- list
15-
- watch
16-
# For automatic cluster domain detection
15+
- get
16+
# Manage core workload resources created per ZookeeperCluster.
17+
# All resources are applied via Server-Side Apply (create + patch) and tracked for
18+
# orphan cleanup (list + delete). Resources watched by the controller also need watch.
19+
# - configmaps: role-group configuration and discovery ConfigMaps (owned by zk and znode controllers)
20+
# - services: role-group headless and metrics services (owned by zk controller)
1721
- apiGroups:
1822
- ""
1923
resources:
20-
- nodes/proxy
24+
- configmaps
25+
- services
2126
verbs:
27+
- create
28+
- delete
2229
- get
30+
- list
31+
- patch
32+
- watch
33+
# ServiceAccounts are created per ZookeeperCluster to bind the product ClusterRole.
34+
# Applied via SSA and tracked for orphan cleanup; not watched by the controller.
2335
- apiGroups:
2436
- ""
2537
resources:
26-
- pods
27-
- configmaps
28-
- secrets
29-
- services
30-
- endpoints
3138
- serviceaccounts
3239
verbs:
3340
- create
3441
- delete
3542
- get
3643
- list
3744
- patch
38-
- update
39-
- watch
45+
# RoleBindings bind the product ClusterRole to per-cluster ServiceAccounts.
46+
# Applied via SSA and tracked for orphan cleanup; not watched by the controller.
4047
- apiGroups:
4148
- rbac.authorization.k8s.io
4249
resources:
@@ -47,8 +54,7 @@ rules:
4754
- get
4855
- list
4956
- patch
50-
- update
51-
- watch
57+
# Required to create RoleBindings that reference the product ClusterRole.
5258
- apiGroups:
5359
- rbac.authorization.k8s.io
5460
resources:
@@ -57,30 +63,21 @@ rules:
5763
- bind
5864
resourceNames:
5965
- {{ include "operator.name" . }}-clusterrole
66+
# StatefulSets are created per role-group. Applied via SSA, tracked for orphan cleanup,
67+
# and watched by the zk controller (via .owns()) to trigger reconciliation on changes.
6068
- apiGroups:
6169
- apps
6270
resources:
6371
- statefulsets
64-
verbs:
65-
- get
66-
- create
67-
- delete
68-
- list
69-
- patch
70-
- update
71-
- watch
72-
- apiGroups:
73-
- batch
74-
resources:
75-
- jobs
7672
verbs:
7773
- create
7874
- delete
7975
- get
8076
- list
8177
- patch
82-
- update
8378
- watch
79+
# PodDisruptionBudgets are created per role. Applied via SSA and tracked for orphan
80+
# cleanup; not watched by the controller.
8481
- apiGroups:
8582
- policy
8683
resources:
@@ -91,8 +88,6 @@ rules:
9188
- get
9289
- list
9390
- patch
94-
- update
95-
- watch
9691
- apiGroups:
9792
- apiextensions.k8s.io
9893
resources:
@@ -108,6 +103,7 @@ rules:
108103
- list
109104
- watch
110105
{{- end }}
106+
# AuthenticationClasses are read to resolve TLS and client authentication configuration.
111107
- apiGroups:
112108
- authentication.stackable.tech
113109
resources:
@@ -116,34 +112,51 @@ rules:
116112
- get
117113
- list
118114
- watch
115+
# Events are emitted to report reconciliation progress and errors.
119116
- apiGroups:
120117
- events.k8s.io
121118
resources:
122119
- events
123120
verbs:
124121
- create
125122
- patch
123+
# Listeners are created per role for load-balanced access to the ZooKeeper cluster.
124+
# Applied via SSA and tracked for orphan cleanup. The znode controller also reads them
125+
# directly (client.get) to build discovery ConfigMaps. Not watched by the controller.
126126
- apiGroups:
127127
- listeners.stackable.tech
128128
resources:
129129
- listeners
130130
verbs:
131+
- create
132+
- delete
131133
- get
132134
- list
133-
- watch
134135
- patch
135-
- create
136-
- delete
136+
# ZookeeperClusters are the primary resource watched by the zk controller (via
137+
# Controller::new), and also watched by the znode controller (via .watches()) to
138+
# trigger znode reconciliation when the cluster changes.
137139
- apiGroups:
138140
- {{ include "operator.name" . }}.stackable.tech
139141
resources:
140142
- {{ include "operator.name" . }}clusters
143+
verbs:
144+
- get
145+
- list
146+
- watch
147+
# ZookeeperZnodes are the primary resource watched by the znode controller (via
148+
# Controller::new). patch is required because the znode controller manages a finalizer
149+
# on ZookeeperZnode objects to clean up the ZooKeeper znode before deletion.
150+
- apiGroups:
151+
- {{ include "operator.name" . }}.stackable.tech
152+
resources:
141153
- {{ include "operator.name" . }}znodes
142154
verbs:
143155
- get
144156
- list
145157
- patch
146158
- watch
159+
# Status subresource patches are used to report cluster state and znode path.
147160
- apiGroups:
148161
- {{ include "operator.name" . }}.stackable.tech
149162
resources:
@@ -159,6 +172,9 @@ metadata:
159172
labels:
160173
{{- include "operator.labels" . | nindent 4 }}
161174
rules:
175+
# ZooKeeper pods read their own ConfigMap for runtime configuration, their Secret for
176+
# TLS credentials (mounted by secret-operator), and their ServiceAccount token for
177+
# Kubernetes API authentication.
162178
- apiGroups:
163179
- ""
164180
resources:
@@ -167,6 +183,7 @@ rules:
167183
- serviceaccounts
168184
verbs:
169185
- get
186+
# ZooKeeper pods emit events to report operational status.
170187
- apiGroups:
171188
- events.k8s.io
172189
resources:
@@ -175,6 +192,7 @@ rules:
175192
- create
176193
- patch
177194
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
195+
# Required on OpenShift to allow ZooKeeper pods to run as non-root (nonroot-v2 SCC).
178196
- apiGroups:
179197
- security.openshift.io
180198
resources:

0 commit comments

Comments
 (0)