Merge pull request #16558 from consideRatio/pr/cleanup-psp
helm: remove legacy PodSecurityPolicy resource
This commit is contained in:
16 files changed
+6
-666
No files matched your search
@@ -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}` |
|
||||
|
||||
@@ -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"}}` |
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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
|
||||
@@ -1,3 +0,0 @@
|
||||
####################################################################################################
|
||||
# This Pod Security Policy (PSP) allows Rook to run in Kubernetes environments using PSPs
|
||||
####################################################################################################
|
||||
@@ -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'
|
||||
|
||||
|
||||
@@ -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 }}
|
||||
@@ -12,10 +12,6 @@
|
||||
*/}}
|
||||
{{ include "library.cluster.clusterrolebindings" . }}
|
||||
|
||||
{{- if .Values.pspEnable }}
|
||||
{{ include "library.cluster.psp.rolebindings" . }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- /*
|
||||
roles
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -15,10 +15,6 @@
|
||||
*/}}
|
||||
{{ include "library.cluster.clusterrolebindings" . }}
|
||||
|
||||
{{- if .Values.pspEnable }}
|
||||
{{ include "library.cluster.psp.rolebindings" . }}
|
||||
{{- end }}
|
||||
|
||||
|
||||
{{- /*
|
||||
roles
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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:
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in new issue
Block a user