Skip to content

Commit 833009b

Browse files
committed
chore: Simplify RBAC rule comments
1 parent 6121eba commit 833009b

1 file changed

Lines changed: 15 additions & 31 deletions

File tree

  • deploy/helm/opensearch-operator/templates

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

Lines changed: 15 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,7 @@ rules:
1313
verbs:
1414
- get
1515
# Manage core workload resources created per OpenSearchCluster.
16-
# All resources are applied via Server-Side Apply (create + patch) and tracked for
17-
# orphan cleanup (list + delete). The controller watches all of these via .owns() (watch).
18-
# get is required by the ReconciliationPaused strategy, which calls client.get() instead
19-
# of apply_patch() when reconciliation is paused.
20-
# update is NOT needed: SSA uses patch (HTTP PATCH), not update (HTTP PUT).
21-
# - configmaps: per-rolegroup configuration files mounted into pods
22-
# - serviceaccounts: per-rolegroup ServiceAccounts for workload pods
23-
# - services: per-rolegroup and discovery Services
16+
# Applied via SSA, tracked for orphan cleanup, and owned by the controller.
2417
- apiGroups:
2518
- ""
2619
resources:
@@ -34,9 +27,8 @@ rules:
3427
- list
3528
- patch
3629
- watch
37-
# RoleBindings bind the product ClusterRole to each per-rolegroup ServiceAccount so that
38-
# workload pods have the permissions they need at runtime.
39-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
30+
# RoleBinding created per role group to bind the product ClusterRole to the workload
31+
# ServiceAccount. Applied via SSA, tracked for orphan cleanup, and owned by the controller.
4032
- apiGroups:
4133
- rbac.authorization.k8s.io
4234
resources:
@@ -48,8 +40,8 @@ rules:
4840
- list
4941
- patch
5042
- watch
51-
# StatefulSets drive the OpenSearch node pods.
52-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
43+
# StatefulSet created per role group. Applied via SSA, tracked for orphan cleanup, and
44+
# owned by the controller.
5345
- apiGroups:
5446
- apps
5547
resources:
@@ -61,8 +53,8 @@ rules:
6153
- list
6254
- patch
6355
- watch
64-
# PodDisruptionBudgets limit voluntary disruptions during rolling upgrades and maintenance.
65-
# Applied via SSA, tracked for orphan cleanup, and watched via .owns().
56+
# PodDisruptionBudget created per role group. Applied via SSA, tracked for orphan cleanup,
57+
# and owned by the controller.
6658
- apiGroups:
6759
- policy
6860
resources:
@@ -90,9 +82,8 @@ rules:
9082
# Required for startup condition
9183
- list
9284
- watch
93-
# Listeners (stackable-listener-operator CRD) expose OpenSearch endpoints via a
94-
# cluster-level abstraction. Applied via SSA, tracked for orphan cleanup, watched via .owns().
95-
# get is also used directly in dereference.rs to fetch the discovery service Listener.
85+
# Listener created per role group for external access. Applied via SSA, tracked for orphan
86+
# cleanup, and owned by the controller.
9687
- apiGroups:
9788
- listeners.stackable.tech
9889
resources:
@@ -104,18 +95,15 @@ rules:
10495
- list
10596
- patch
10697
- watch
107-
# Events are emitted by the controller to report reconciliation results (e.g. errors,
108-
# status changes) visible via kubectl describe / kubectl get events.
98+
# Required to report reconciliation results and warnings back to the OpenSearchCluster object.
10999
- apiGroups:
110100
- events.k8s.io
111101
resources:
112102
- events
113103
verbs:
114104
- create
115105
- patch
116-
# The primary CRD: the controller watches OpenSearchCluster objects to trigger reconciliation
117-
# and reads them during reconcile. patch is NOT needed here — the operator only writes
118-
# to the /status subresource (see rule below).
106+
# Primary CRD: watched by Controller::new() and read during reconciliation.
119107
- apiGroups:
120108
- {{ include "operator.name" . }}.stackable.tech
121109
resources:
@@ -124,16 +112,14 @@ rules:
124112
- get
125113
- list
126114
- watch
127-
# Status subresource: the controller calls apply_patch_status() after each reconcile to
128-
# update conditions (Available, Degraded, etc.) on the OpenSearchCluster object.
115+
# Status subresource: updated at the end of every reconciliation.
129116
- apiGroups:
130117
- {{ include "operator.name" . }}.stackable.tech
131118
resources:
132119
- {{ include "operator.name" . }}clusters/status
133120
verbs:
134121
- patch
135-
# The operator creates per-rolegroup RoleBindings that bind the product ClusterRole to
136-
# workload ServiceAccounts. bind permission on the product ClusterRole is required for that.
122+
# Required to bind the product ClusterRole to the per-rolegroup ServiceAccount.
137123
- apiGroups:
138124
- rbac.authorization.k8s.io
139125
resources:
@@ -150,7 +136,7 @@ metadata:
150136
labels:
151137
{{- include "operator.labels" . | nindent 4 }}
152138
rules:
153-
# OpenSearch pods emit Kubernetes Events (e.g. via the Stackable logging framework).
139+
# Allows OpenSearch pods to emit Kubernetes events.
154140
- apiGroups:
155141
- events.k8s.io
156142
resources:
@@ -159,9 +145,7 @@ rules:
159145
- create
160146
- patch
161147
{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }}
162-
# Required on OpenShift: allows OpenSearch pods to run with the nonroot-v2
163-
# SecurityContextConstraint, which permits running as a non-root UID without a specific
164-
# seccomp profile.
148+
# Required on OpenShift to allow the OpenSearch pods to run as a non-root user.
165149
- apiGroups:
166150
- security.openshift.io
167151
resources:

0 commit comments

Comments
 (0)