diff --git a/CHANGELOG.md b/CHANGELOG.md index 69b5cdea..81f342d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## [Unreleased] +- Document Helm deployed RBAC permissions and remove unnecessary permissions ([#717]). + +[#717]: https://github.com/stackabletech/superset-operator/pull/717 + ## [26.3.0] - 2026-03-16 ## [26.3.0-rc1] - 2026-03-16 diff --git a/deploy/helm/superset-operator/templates/roles.yaml b/deploy/helm/superset-operator/templates/clusterrole-operator.yaml similarity index 63% rename from deploy/helm/superset-operator/templates/roles.yaml rename to deploy/helm/superset-operator/templates/clusterrole-operator.yaml index cf337e93..a81c1a2a 100644 --- a/deploy/helm/superset-operator/templates/roles.yaml +++ b/deploy/helm/superset-operator/templates/clusterrole-operator.yaml @@ -6,13 +6,6 @@ metadata: labels: {{- include "operator.labels" . | nindent 4 }} rules: - - apiGroups: - - "" - resources: - - nodes - verbs: - - list - - watch # For automatic cluster domain detection - apiGroups: - "" @@ -20,24 +13,35 @@ rules: - nodes/proxy verbs: - get + # Manage core namespaced resources created per SupersetCluster. + # All resources are applied via Server-Side Apply (create + patch) and tracked for + # orphan cleanup (list + delete). ReconciliationPaused uses get. - apiGroups: - "" resources: - - pods - configmaps - - secrets - services - - endpoints - - serviceaccounts - - secrets verbs: - create - delete - get - list - patch - - update - watch + # ServiceAccount created per SupersetCluster and per DruidConnection. + # Applied via SSA and tracked for orphan cleanup. + - apiGroups: + - "" + resources: + - serviceaccounts + verbs: + - create + - delete + - get + - list + - patch + # RoleBinding created per SupersetCluster to bind the product ClusterRole to the workload + # ServiceAccount. Applied via SSA and tracked for orphan cleanup. - apiGroups: - rbac.authorization.k8s.io resources: @@ -48,32 +52,39 @@ rules: - get - list - patch - - update - - watch + # Required to bind the product ClusterRole to the per-cluster ServiceAccount. + - apiGroups: + - rbac.authorization.k8s.io + resources: + - clusterroles + verbs: + - bind + resourceNames: + - {{ include "operator.name" . }}-clusterrole + # StatefulSet created per role group. Applied via SSA and tracked for orphan cleanup. - apiGroups: - apps resources: - statefulsets verbs: - - get - create - delete + - get - list - patch - - update - watch + # Job created per DruidConnection to run the datasource import task. - apiGroups: - batch resources: - jobs verbs: - create - - delete - get - list - patch - - update - watch + # PodDisruptionBudget created per role. Applied via SSA and tracked for orphan cleanup. - apiGroups: - policy resources: @@ -84,23 +95,23 @@ rules: - get - list - patch - - update - - watch + # Required for maintaining the CRDs within the operator (including the conversion webhook info). + # Also for the startup condition check before the controller can run. - apiGroups: - apiextensions.k8s.io resources: - customresourcedefinitions verbs: - - get # Required to maintain the CRD. The operator needs to do this, as it needs to enter e.g. it's # generated certificate in the conversion webhook. {{- if .Values.maintenance.customResourceDefinitions.maintain }} - create - patch + {{- end }} # Required for startup condition - list - watch - {{- end }} + # Required to report reconciliation results and errors back to the SupersetCluster object. - apiGroups: - events.k8s.io resources: @@ -108,23 +119,31 @@ rules: verbs: - create - patch + # Primary CRDs: SupersetCluster and DruidConnection. - apiGroups: - {{ include "operator.name" . }}.stackable.tech resources: - {{ include "operator.name" . }}clusters - druidconnections - - druidconnections/status verbs: - get - list - - patch - watch + # Patch status for SupersetCluster (reports conditions such as Available/Degraded). - apiGroups: - {{ include "operator.name" . }}.stackable.tech resources: - {{ include "operator.name" . }}clusters/status verbs: - patch + # Patch status for DruidConnection (tracks import job progress: Pending/Importing/Ready/Failed). + - apiGroups: + - {{ include "operator.name" . }}.stackable.tech + resources: + - druidconnections/status + verbs: + - patch + # Watch AuthenticationClass resources to react when authentication configuration changes. - apiGroups: - authentication.stackable.tech resources: @@ -133,55 +152,15 @@ rules: - get - list - watch - - apiGroups: - - rbac.authorization.k8s.io - resources: - - clusterroles - verbs: - - bind - resourceNames: - - {{ include "operator.name" . }}-clusterrole + # Listener created per role group for external access. Applied via SSA and tracked for orphan + # cleanup. - apiGroups: - listeners.stackable.tech resources: - listeners verbs: - - get - - list - - watch - - patch - create - delete ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: {{ include "operator.name" . }}-clusterrole - labels: - {{- include "operator.labels" . | nindent 4 }} -rules: - - apiGroups: - - "" - resources: - - configmaps - - secrets - - serviceaccounts - verbs: - get - - apiGroups: - - events.k8s.io - resources: - - events - verbs: - - create + - list - patch -{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }} - - apiGroups: - - security.openshift.io - resources: - - securitycontextconstraints - resourceNames: - - nonroot-v2 - verbs: - - use -{{ end }} diff --git a/deploy/helm/superset-operator/templates/clusterrole-product.yaml b/deploy/helm/superset-operator/templates/clusterrole-product.yaml new file mode 100644 index 00000000..ebabcd19 --- /dev/null +++ b/deploy/helm/superset-operator/templates/clusterrole-product.yaml @@ -0,0 +1,21 @@ +--- +# Product ClusterRole: bound (via per SupersetCluster RoleBinding) to the ServiceAccount that +# Superset workload pods run as. +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ include "operator.name" . }}-clusterrole + labels: + {{- include "operator.labels" . | nindent 4 }} +rules: +{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }} + # Required on OpenShift to allow Superset pods to run as a non-root user. + - apiGroups: + - security.openshift.io + resources: + - securitycontextconstraints + resourceNames: + - nonroot-v2 + verbs: + - use +{{ end }}