diff --git a/Documentation/Helm-Charts/ceph-cluster-chart.md b/Documentation/Helm-Charts/ceph-cluster-chart.md index 60866675d..4d3354a03 100644 --- a/Documentation/Helm-Charts/ceph-cluster-chart.md +++ b/Documentation/Helm-Charts/ceph-cluster-chart.md @@ -80,7 +80,6 @@ The following table lists the configurable parameters of the rook-operator chart | `monitoring.prometheusRuleOverrides` | Edit Prometheus rules for Ceph alerts | `{}` | | `monitoring.rulesNamespaceOverride` | The namespace in which to create the prometheus rules, if different from the rook cluster namespace. If you have multiple rook-ceph clusters in the same k8s cluster, choose the same namespace (ideally, namespace with prometheus deployed) to set rulesNamespaceOverride for all the clusters. Otherwise, you will get duplicate alerts with multiple alert definitions. | `nil` | | `operatorNamespace` | Namespace of the main rook operator | `"rook-ceph"` | -| `pspEnable` | Create & use PSP resources. Set this to the same value as the rook-ceph chart. | `false` | | `route.dashboard` | Enable an HTTPRoute for the ceph-dashboard | `{}` | | `toolbox.affinity` | Toolbox affinity | `{}` | | `toolbox.containerSecurityContext` | Toolbox container security context | `{"capabilities":{"drop":["ALL"]},"runAsGroup":2016,"runAsNonRoot":true,"runAsUser":2016}` | diff --git a/Documentation/Helm-Charts/operator-chart.md b/Documentation/Helm-Charts/operator-chart.md index 598918a7d..33cd21247 100644 --- a/Documentation/Helm-Charts/operator-chart.md +++ b/Documentation/Helm-Charts/operator-chart.md @@ -165,7 +165,6 @@ The following table lists the configurable parameters of the rook-operator chart | `obcProvisionerNamePrefix` | Specify the prefix for the OBC provisioner in place of the cluster namespace | `ceph cluster namespace` | | `operatorPodLabels` | Custom pod labels for the operator | `{}` | | `priorityClassName` | Set the priority class for the rook operator deployment if desired | `nil` | -| `pspEnable` | If true, create & use PSP resources | `false` | | `rbacAggregate.enableOBCs` | If true, create a ClusterRole aggregated to [user facing roles](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) for objectbucketclaims | `false` | | `rbacEnable` | If true, create & use RBAC resources | `true` | | `resources` | Pod resource requests & limits | `{"limits":{"memory":"512Mi"},"requests":{"cpu":"200m","memory":"128Mi"}}` | diff --git a/build/rbac/gen-common.sh b/build/rbac/gen-common.sh index b5ff559d8..4d8390408 100755 --- a/build/rbac/gen-common.sh +++ b/build/rbac/gen-common.sh @@ -6,8 +6,6 @@ pushd "$SCRIPT_DIR" &>/dev/stderr COMMON_YAML_FILE="$SCRIPT_DIR/../../deploy/examples/common.yaml" -export ADDITIONAL_HELM_CLI_OPTIONS="--set pspEnable=false" - rm -f "$COMMON_YAML_FILE" cat common.yaml.header >>"$COMMON_YAML_FILE" ./get-helm-rbac.sh >>"$COMMON_YAML_FILE" diff --git a/build/rbac/gen-psp.sh b/build/rbac/gen-psp.sh deleted file mode 100755 index 99142b4b0..000000000 --- a/build/rbac/gen-psp.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env bash -set -xeEuo pipefail - -SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" -pushd "$SCRIPT_DIR" &>/dev/stderr - -PSP_YAML_FILE="$SCRIPT_DIR/../../deploy/examples/psp.yaml" - -tmpdir="$(mktemp -d)" -WITHOUT_FILE="${tmpdir}"/without-psp.yaml # intermediate file of yaml that doesn't include PSP -WITH_FILE="${tmpdir}"/with-psp.yaml # intermediate file of yaml that includes previous plus PSP - -export ADDITIONAL_HELM_CLI_OPTIONS="--set pspEnable=false" -./get-helm-rbac.sh >"$WITHOUT_FILE" - -export ADDITIONAL_HELM_CLI_OPTIONS="--set pspEnable=true" -./get-helm-rbac.sh >"$WITH_FILE" - -rm -f "$PSP_YAML_FILE" -cat psp.yaml.header >>"$PSP_YAML_FILE" -./keep-added.sh "$WITHOUT_FILE" "$WITH_FILE" >>"$PSP_YAML_FILE" - -rm -rf "$tmpdir" -popd &>/dev/stderr diff --git a/build/rbac/psp.yaml.header b/build/rbac/psp.yaml.header deleted file mode 100644 index 049a2ec11..000000000 --- a/build/rbac/psp.yaml.header +++ /dev/null @@ -1,3 +0,0 @@ -#################################################################################################### -# This Pod Security Policy (PSP) allows Rook to run in Kubernetes environments using PSPs -#################################################################################################### diff --git a/deploy/charts/library/Chart.yaml b/deploy/charts/library/Chart.yaml index 6b86d419c..5100d63f5 100644 --- a/deploy/charts/library/Chart.yaml +++ b/deploy/charts/library/Chart.yaml @@ -12,7 +12,7 @@ type: library # - templates named with '_cluster-*' are for CephCluster-scoped resources # - cluster-scoped definitions are named 'library.cluster.*' # - prefer templates that are named to their purpose (prefer avoiding '_helper.tpl') -# - prefer combining features that can be enabled/disabled together (e.g., monitoring or PSP) into +# - prefer combining features that can be enabled/disabled together (e.g., monitoring) into # feature templates rather than spreading the content among lower-level templates like # '_*rolebinding.tpl' diff --git a/deploy/charts/library/templates/_cluster-psp.tpl b/deploy/charts/library/templates/_cluster-psp.tpl deleted file mode 100644 index 848cd6ba5..000000000 --- a/deploy/charts/library/templates/_cluster-psp.tpl +++ /dev/null @@ -1,95 +0,0 @@ -{{- /* - RoleBindings needed to enable Pod Security Policies for a CephCluster. -*/}} -{{- define "library.cluster.psp.rolebindings" -}} -{{- if semverCompare "<1.25.0-0" .Capabilities.KubeVersion.GitVersion -}} ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-default-psp - namespace: {{ .Release.Namespace }} # namespace:cluster - labels: - operator: rook - storage-backend: ceph - {{- include "library.rook-ceph.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: default - namespace: {{ .Release.Namespace }} # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-osd-psp - namespace: {{ .Release.Namespace }} # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-osd - namespace: {{ .Release.Namespace }} # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-rgw-psp - namespace: {{ .Release.Namespace }} # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-rgw - namespace: {{ .Release.Namespace }} # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-mgr-psp - namespace: {{ .Release.Namespace }} # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-mgr - namespace: {{ .Release.Namespace }} # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-cmd-reporter-psp - namespace: {{ .Release.Namespace }} # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-cmd-reporter - namespace: {{ .Release.Namespace }} # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-purge-osd-psp - namespace: {{ .Release.Namespace }} # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-purge-osd - namespace: {{ .Release.Namespace }} # namespace:cluster -{{- end }} -{{- end }} diff --git a/deploy/charts/rook-ceph-cluster/templates/rbac.yaml b/deploy/charts/rook-ceph-cluster/templates/rbac.yaml index 9dffd8835..e3d33913b 100644 --- a/deploy/charts/rook-ceph-cluster/templates/rbac.yaml +++ b/deploy/charts/rook-ceph-cluster/templates/rbac.yaml @@ -12,10 +12,6 @@ */}} {{ include "library.cluster.clusterrolebindings" . }} -{{- if .Values.pspEnable }} -{{ include "library.cluster.psp.rolebindings" . }} -{{- end }} - {{- /* roles diff --git a/deploy/charts/rook-ceph-cluster/values.yaml b/deploy/charts/rook-ceph-cluster/values.yaml index 431cdbca6..bffff1fd5 100644 --- a/deploy/charts/rook-ceph-cluster/values.yaml +++ b/deploy/charts/rook-ceph-cluster/values.yaml @@ -58,8 +58,7 @@ monitoring: # -- Whether to create the Prometheus rules for Ceph alerts createPrometheusRules: false # -- Edit Prometheus rules for Ceph alerts - prometheusRuleOverrides: - {} + prometheusRuleOverrides: {} # CephHealthWarning: # disabled: true # NVMeoFHighWriteLatency: @@ -82,9 +81,6 @@ monitoring: # -- Annotations applied to PrometheusRule annotations: {} -# -- Create & use PSP resources. Set this to the same value as the rook-ceph chart. -pspEnable: false - # imagePullSecrets option allow to pull docker images from private docker registry. Option will be passed to all service accounts. # imagePullSecrets: # - name: my-registry-secret @@ -429,8 +425,7 @@ cephClusterSpec: ingress: # -- Enable an ingress for the ceph-dashboard - dashboard: - {} + dashboard: {} # labels: # external-dns/private: "true" # annotations: @@ -454,8 +449,7 @@ ingress: route: # -- Enable an HTTPRoute for the ceph-dashboard - dashboard: - {} + dashboard: {} # labels: # external-dns/private: "true" # annotations: diff --git a/deploy/charts/rook-ceph/templates/cluster-rbac.yaml b/deploy/charts/rook-ceph/templates/cluster-rbac.yaml index 2d0e20993..231be48c0 100644 --- a/deploy/charts/rook-ceph/templates/cluster-rbac.yaml +++ b/deploy/charts/rook-ceph/templates/cluster-rbac.yaml @@ -15,10 +15,6 @@ */}} {{ include "library.cluster.clusterrolebindings" . }} -{{- if .Values.pspEnable }} -{{ include "library.cluster.psp.rolebindings" . }} -{{- end }} - {{- /* roles diff --git a/deploy/charts/rook-ceph/templates/psp.yaml b/deploy/charts/rook-ceph/templates/psp.yaml deleted file mode 100644 index c76dbd540..000000000 --- a/deploy/charts/rook-ceph/templates/psp.yaml +++ /dev/null @@ -1,174 +0,0 @@ -{{- if .Values.pspEnable -}} -{{- if semverCompare "<1.25.0-0" .Capabilities.KubeVersion.GitVersion -}} ---- -# We expect most Kubernetes teams to follow the Kubernetes docs and have these PSPs. -# * privileged (for kube-system namespace) -# * restricted (for all logged in users) -# -# PSPs are applied based on the first match alphabetically. `rook-ceph-operator` comes after -# `restricted` alphabetically, so we name this `00-rook-privileged`, so it stays somewhere -# close to the top and so `rook-system` gets the intended PSP. This may need to be renamed in -# environments with other `00`-prefixed PSPs. -# -# More on PSP ordering: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#policy-order -kind: PodSecurityPolicy -apiVersion: policy/v1beta1 -metadata: - name: 00-rook-privileged - annotations: - seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'runtime/default' - seccomp.security.alpha.kubernetes.io/defaultProfileName: 'runtime/default' -spec: - privileged: true - allowedCapabilities: - # required by CSI - - SYS_ADMIN - - MKNOD - fsGroup: - rule: RunAsAny - # runAsUser, supplementalGroups - Rook needs to run some pods as root - # Ceph pods could be run as the Ceph user, but that user isn't always known ahead of time - runAsUser: - rule: RunAsAny - supplementalGroups: - rule: RunAsAny - # seLinux - seLinux context is unknown ahead of time; set if this is well-known - seLinux: - rule: RunAsAny - volumes: - # recommended minimum set - - configMap - - downwardAPI - - emptyDir - - persistentVolumeClaim - - secret - - projected - # required for Rook - - hostPath - # allowedHostPaths can be set to Rook's known host volume mount points when they are fully-known - # allowedHostPaths: - # - pathPrefix: "/run/udev" # for OSD prep - # readOnly: false - # - pathPrefix: "/dev" # for OSD prep - # readOnly: false - # - pathPrefix: "/var/lib/rook" # or whatever the dataDirHostPath value is set to - # readOnly: false - # Ceph requires host IPC for setting up encrypted devices - hostIPC: true - # Ceph OSDs need to share the same PID namespace - hostPID: true - # hostNetwork can be set to 'false' if host networking isn't used - hostNetwork: true - hostPorts: - # Ceph messenger protocol v1 - - min: 6789 - max: 6790 # <- support old default port - # Ceph messenger protocol v2 - - min: 3300 - max: 3300 - # Ceph RADOS ports for OSDs, MDSes - - min: 6800 - max: 7300 - # # Ceph dashboard port HTTP (not recommended) - # - min: 7000 - # max: 7000 - # Ceph dashboard port HTTPS - - min: 8443 - max: 8443 - # Ceph mgr Prometheus Metrics - - min: 9283 - max: 9283 - # port for CSIAddons - - min: 9070 - max: 9070 -{{- if .Values.rbacEnable }} ---- -kind: ClusterRole -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: 'psp:rook' - labels: - operator: rook - storage-backend: ceph - {{- include "library.rook-ceph.labels" . | nindent 4 }} -rules: - - apiGroups: - - policy - resources: - - podsecuritypolicies - resourceNames: - - 00-rook-privileged - verbs: - - use ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-system-psp - labels: - operator: rook - storage-backend: ceph - {{- include "library.rook-ceph.labels" . | nindent 4 }} -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-ceph-system - namespace: {{ .Release.Namespace }} # namespace:operator ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-csi-cephfs-provisioner-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-cephfs-provisioner-sa - namespace: {{ .Release.Namespace }} # namespace:operator ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-csi-cephfs-plugin-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-cephfs-plugin-sa - namespace: {{ .Release.Namespace }} # namespace:operator ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-csi-rbd-plugin-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-rbd-plugin-sa - namespace: {{ .Release.Namespace }} # namespace:operator ---- -kind: ClusterRoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-csi-rbd-provisioner-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-rbd-provisioner-sa - namespace: {{ .Release.Namespace }} # namespace:operator -{{- end }} -{{- end }} -{{- end }} diff --git a/deploy/charts/rook-ceph/values.yaml b/deploy/charts/rook-ceph/values.yaml index ca003cd5d..19fe484a2 100644 --- a/deploy/charts/rook-ceph/values.yaml +++ b/deploy/charts/rook-ceph/values.yaml @@ -61,9 +61,6 @@ rbacAggregate: # -- If true, create a ClusterRole aggregated to [user facing roles](https://kubernetes.io/docs/reference/access-authn-authz/rbac/#user-facing-roles) for objectbucketclaims enableOBCs: false -# -- If true, create & use PSP resources -pspEnable: false - # -- Set the priority class for the rook operator deployment if desired priorityClassName: diff --git a/deploy/examples/common-second-cluster.yaml b/deploy/examples/common-second-cluster.yaml index 13b43ca43..179903c18 100644 --- a/deploy/examples/common-second-cluster.yaml +++ b/deploy/examples/common-second-cluster.yaml @@ -39,20 +39,6 @@ subjects: --- kind: RoleBinding apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-cmd-reporter-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-cmd-reporter - namespace: rook-ceph-secondary # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 metadata: name: rook-ceph-mgr-system-secondary namespace: rook-ceph # namespace:operator @@ -65,76 +51,6 @@ subjects: name: rook-ceph-mgr namespace: rook-ceph-secondary # namespace:cluster --- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-mgr-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-mgr - namespace: rook-ceph-secondary # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-osd-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-osd - namespace: rook-ceph-secondary # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-purge-osd-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-purge-osd - namespace: rook-ceph-secondary # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-rgw-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-rgw - namespace: rook-ceph-secondary # namespace:cluster ---- -kind: RoleBinding -apiVersion: rbac.authorization.k8s.io/v1 -metadata: - name: rook-ceph-default-psp - namespace: rook-ceph-secondary # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: default - namespace: rook-ceph-secondary # namespace:cluster ---- apiVersion: v1 kind: ServiceAccount metadata: diff --git a/deploy/examples/psp.yaml b/deploy/examples/psp.yaml deleted file mode 100644 index a290544c2..000000000 --- a/deploy/examples/psp.yaml +++ /dev/null @@ -1,259 +0,0 @@ -#################################################################################################### -# This Pod Security Policy (PSP) allows Rook to run in Kubernetes environments using PSPs -#################################################################################################### ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - name: 'psp:rook' - labels: - operator: rook - storage-backend: ceph - app.kubernetes.io/part-of: rook-ceph-operator -rules: - - apiGroups: - - policy - resources: - - podsecuritypolicies - resourceNames: - - 00-rook-privileged - verbs: - - use ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: rook-ceph-system-psp - labels: - operator: rook - storage-backend: ceph - app.kubernetes.io/part-of: rook-ceph-operator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-ceph-system - namespace: rook-ceph # namespace:operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: rook-csi-cephfs-plugin-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-cephfs-plugin-sa - namespace: rook-ceph # namespace:operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: rook-csi-cephfs-provisioner-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-cephfs-provisioner-sa - namespace: rook-ceph # namespace:operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: rook-csi-rbd-plugin-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-rbd-plugin-sa - namespace: rook-ceph # namespace:operator ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRoleBinding -metadata: - name: rook-csi-rbd-provisioner-sa-psp -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: 'psp:rook' -subjects: - - kind: ServiceAccount - name: rook-csi-rbd-provisioner-sa - namespace: rook-ceph # namespace:operator ---- -# We expect most Kubernetes teams to follow the Kubernetes docs and have these PSPs. -# * privileged (for kube-system namespace) -# * restricted (for all logged in users) -# -# PSPs are applied based on the first match alphabetically. `rook-ceph-operator` comes after -# `restricted` alphabetically, so we name this `00-rook-privileged`, so it stays somewhere -# close to the top and so `rook-system` gets the intended PSP. This may need to be renamed in -# environments with other `00`-prefixed PSPs. -# -# More on PSP ordering: https://kubernetes.io/docs/concepts/policy/pod-security-policy/#policy-order -apiVersion: policy/v1beta1 -kind: PodSecurityPolicy -metadata: - name: 00-rook-privileged - annotations: - seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'runtime/default' - seccomp.security.alpha.kubernetes.io/defaultProfileName: 'runtime/default' -spec: - privileged: true - allowedCapabilities: - # required by CSI - - SYS_ADMIN - - MKNOD - fsGroup: - rule: RunAsAny - # runAsUser, supplementalGroups - Rook needs to run some pods as root - # Ceph pods could be run as the Ceph user, but that user isn't always known ahead of time - runAsUser: - rule: RunAsAny - supplementalGroups: - rule: RunAsAny - # seLinux - seLinux context is unknown ahead of time; set if this is well-known - seLinux: - rule: RunAsAny - volumes: - # recommended minimum set - - configMap - - downwardAPI - - emptyDir - - persistentVolumeClaim - - secret - - projected - # required for Rook - - hostPath - # allowedHostPaths can be set to Rook's known host volume mount points when they are fully-known - # allowedHostPaths: - # - pathPrefix: "/run/udev" # for OSD prep - # readOnly: false - # - pathPrefix: "/dev" # for OSD prep - # readOnly: false - # - pathPrefix: "/var/lib/rook" # or whatever the dataDirHostPath value is set to - # readOnly: false - # Ceph requires host IPC for setting up encrypted devices - hostIPC: true - # Ceph OSDs need to share the same PID namespace - hostPID: true - # hostNetwork can be set to 'false' if host networking isn't used - hostNetwork: true - hostPorts: - # Ceph messenger protocol v1 - - min: 6789 - max: 6790 # <- support old default port - # Ceph messenger protocol v2 - - min: 3300 - max: 3300 - # Ceph RADOS ports for OSDs, MDSes - - min: 6800 - max: 7300 - # # Ceph dashboard port HTTP (not recommended) - # - min: 7000 - # max: 7000 - # Ceph dashboard port HTTPS - - min: 8443 - max: 8443 - # Ceph mgr Prometheus Metrics - - min: 9283 - max: 9283 - # port for CSIAddons - - min: 9070 - max: 9070 ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-cmd-reporter-psp - namespace: rook-ceph # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-cmd-reporter - namespace: rook-ceph # namespace:cluster ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-default-psp - namespace: rook-ceph # namespace:cluster - labels: - operator: rook - storage-backend: ceph - app.kubernetes.io/part-of: rook-ceph-operator -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: default - namespace: rook-ceph # namespace:cluster ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-mgr-psp - namespace: rook-ceph # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-mgr - namespace: rook-ceph # namespace:cluster ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-osd-psp - namespace: rook-ceph # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-osd - namespace: rook-ceph # namespace:cluster ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-purge-osd-psp - namespace: rook-ceph # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-purge-osd - namespace: rook-ceph # namespace:cluster ---- -apiVersion: rbac.authorization.k8s.io/v1 -kind: RoleBinding -metadata: - name: rook-ceph-rgw-psp - namespace: rook-ceph # namespace:cluster -roleRef: - apiGroup: rbac.authorization.k8s.io - kind: ClusterRole - name: psp:rook -subjects: - - kind: ServiceAccount - name: rook-ceph-rgw - namespace: rook-ceph # namespace:cluster diff --git a/design/ceph/security-model.md b/design/ceph/security-model.md index e97030b19..e1e76f324 100644 --- a/design/ceph/security-model.md +++ b/design/ceph/security-model.md @@ -250,7 +250,7 @@ subjects: namespace: rook-system ``` -Notably absent here are privileges to set other RBAC rules and create read cluster-wide secrets and other resources. Because the admin created the `rook-system` namespace and service account they are free to set policies on them using PSP or namespace quotas. +Notably absent here are privileges to set other RBAC rules and create read cluster-wide secrets and other resources. Because the admin created the `rook-system` namespace and service account they are free to set policies on them using namespace quotas. Also note that while we use a `ClusterRole` for rook-system we only use a `RoleBinding` to grant it access to the `rook-system` namespace. It does not have cluster-wide privileges. diff --git a/tests/scripts/github-action-helper.sh b/tests/scripts/github-action-helper.sh index f487883d8..5bc0fc86a 100755 --- a/tests/scripts/github-action-helper.sh +++ b/tests/scripts/github-action-helper.sh @@ -242,7 +242,7 @@ function validate_yaml() { kubectl create -k "${cosi_crd_url}" # skipping folders and some yamls that are only for openshift. - manifests="$(find . -maxdepth 1 -type f -name '*.yaml' -and -not -name '*openshift*' -and -not -name 'scc*' -and -not -name 'psp*' -and -not -name 'kustomization*')" + manifests="$(find . -maxdepth 1 -type f -name '*.yaml' -and -not -name '*openshift*' -and -not -name 'scc*' -and -not -name 'kustomization*')" with_f_arg="$(echo "$manifests" | awk '{printf " -f %s",$1}')" # don't add newline # shellcheck disable=SC2086 # '-f manifest1.yaml -f manifest2.yaml etc.' should not be quoted kubectl create ${with_f_arg} --dry-run=client