|
| 1 | +--- |
| 2 | +# Product ClusterRole: bound (via per-HdfsCluster RoleBinding) to the ServiceAccount that HDFS |
| 3 | +# workload pods (namenodes, datanodes, journalnodes) run as. |
| 4 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 5 | +kind: ClusterRole |
| 6 | +metadata: |
| 7 | + name: {{ include "operator.name" . }}-clusterrole |
| 8 | + labels: |
| 9 | + {{- include "operator.labels" . | nindent 4 }} |
| 10 | +rules: |
| 11 | + # Read configuration and identity resources mounted or referenced by product pods. |
| 12 | + # - configmaps: HDFS configuration files |
| 13 | + # - secrets: TLS certificates and Kerberos keytabs (provided by secret-operator volumes) |
| 14 | + # - serviceaccounts: bound service account token projection |
| 15 | + # - pods: pod self-inspection (e.g. hostname resolution, ZooKeeper coordination) |
| 16 | + - apiGroups: |
| 17 | + - "" |
| 18 | + resources: |
| 19 | + - configmaps |
| 20 | + - secrets |
| 21 | + - serviceaccounts |
| 22 | + - pods |
| 23 | + verbs: |
| 24 | + - get |
| 25 | + # List pods for topology detection and peer discovery. |
| 26 | + - apiGroups: |
| 27 | + - "" |
| 28 | + resources: |
| 29 | + - pods |
| 30 | + verbs: |
| 31 | + - list |
| 32 | + # Required to report events from HDFS product pods. |
| 33 | + - apiGroups: |
| 34 | + - events.k8s.io |
| 35 | + resources: |
| 36 | + - events |
| 37 | + verbs: |
| 38 | + - create |
| 39 | + - patch |
| 40 | +{{ if .Capabilities.APIVersions.Has "security.openshift.io/v1" }} |
| 41 | + # Required on OpenShift to allow HDFS pods to run as a non-root user. |
| 42 | + - apiGroups: |
| 43 | + - security.openshift.io |
| 44 | + resources: |
| 45 | + - securitycontextconstraints |
| 46 | + resourceNames: |
| 47 | + - nonroot-v2 |
| 48 | + verbs: |
| 49 | + - use |
| 50 | +{{ end }} |
| 51 | +--- |
| 52 | +# Nodes ClusterRole: bound (via a single cluster-scoped ClusterRoleBinding) to the same |
| 53 | +# ServiceAccount. Grants the additional permissions needed by the HDFS topology provider |
| 54 | +# for rack awareness, which requires cluster-wide pod, node, and endpoint access. |
| 55 | +apiVersion: rbac.authorization.k8s.io/v1 |
| 56 | +kind: ClusterRole |
| 57 | +metadata: |
| 58 | + name: {{ include "operator.name" . }}-clusterrole-nodes |
| 59 | + labels: |
| 60 | + {{- include "operator.labels" . | nindent 4 }} |
| 61 | +rules: |
| 62 | + # The topology provider (rack awareness) running inside HDFS pods queries pod, node, and |
| 63 | + # endpoint information to compute rack labels for DataNodes. |
| 64 | + # - pods: discover pod-to-node assignment for topology calculation; watched by pod informer |
| 65 | + # - nodes: read rack labels (e.g. topology.kubernetes.io/zone) from the node the pod runs on |
| 66 | + # - endpoints: map service endpoints to pod IPs for topology resolution |
| 67 | + - apiGroups: |
| 68 | + - "" |
| 69 | + resources: |
| 70 | + - pods |
| 71 | + - nodes |
| 72 | + - endpoints |
| 73 | + verbs: |
| 74 | + - get |
| 75 | + - list |
| 76 | + # needed for pod informer |
| 77 | + - watch |
| 78 | + # Read listener addresses so HDFS pods can resolve external access endpoints. |
| 79 | + - apiGroups: |
| 80 | + - listeners.stackable.tech |
| 81 | + resources: |
| 82 | + - listeners |
| 83 | + verbs: |
| 84 | + - get |
| 85 | + - list |
| 86 | + # Required to discover the installed CRD API version before querying listeners. |
| 87 | + - apiGroups: |
| 88 | + - apiextensions.k8s.io |
| 89 | + resources: |
| 90 | + - customresourcedefinitions |
| 91 | + verbs: |
| 92 | + - get |
0 commit comments