3c4ebf0172
This change updates the namespace-config chart to (optionally) create RBAC rules allowing service accounts in the namespace 'use' access to an existing Pod Security Policy in the cluster. The policy is specified as: podSecurityPolicy: existingPsp: name-of-existing-psp This aligns with the PSP deprecation guidance provided to date [0], which suggests easing the transition to the "PSP Replacement Policy" by establishing the standard PSPs (Restricted, Baseline, and Privileged), assigning a cluster-wide default, and binding more-permissive policies as needed in certain namespaces. [0] https://kubernetes.io/blog/2021/04/06/podsecuritypolicy-deprecation-past-present-and-future/ Change-Id: I46da230abf822e0cc3553561fd779444439c34a7
30 lines
652 B
YAML
30 lines
652 B
YAML
{{- if (not (empty .Values.podSecurityPolicy.existingPsp)) -}}
|
|
{{- $name := printf "psp:%s:%s" .Release.Name .Values.podSecurityPolicy.existingPsp -}}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: {{ $name }}
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: {{ $name }}
|
|
subjects:
|
|
- kind: Group
|
|
name: system:serviceaccounts:{{ .Release.Namespace }}
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: {{ $name }}
|
|
rules:
|
|
- apiGroups:
|
|
- policy
|
|
resources:
|
|
- podsecuritypolicies
|
|
verbs:
|
|
- use
|
|
resourceNames:
|
|
- {{ .Values.podSecurityPolicy.existingPsp }}
|
|
{{- end -}}
|