[rancher-tracing] Replace global.rbac.pspEnabled flag.

* Replace previous global.rbac.pspEnabled flag with global.cattle.psp.enabled.
* Add new flag to values.yaml.
* Include validation in validate-psp-install.yaml.
pull/2379/head
Mauren Berti 2023-01-30 10:43:53 -05:00
parent 609e8972e7
commit aed199798c
No known key found for this signature in database
GPG Key ID: 777EC11C23B91E1E
4 changed files with 11 additions and 4 deletions

View File

@ -68,7 +68,7 @@ spec:
affinity: affinity:
{{- include "nodeAffinity" . | indent 6 }} {{- include "nodeAffinity" . | indent 6 }}
{{- include "podAntiAffinity" . | indent 6 }} {{- include "podAntiAffinity" . | indent 6 }}
{{- if .Values.global.rbac.pspEnabled }} {{- if .Values.global.cattle.psp.enabled }}
securityContext: securityContext:
runAsNonRoot: true runAsNonRoot: true
runAsUser: 1000 runAsUser: 1000

View File

@ -1,4 +1,4 @@
{{- if .Values.global.rbac.pspEnabled }} {{- if .Values.global.cattle.psp.enabled }}
apiVersion: v1 apiVersion: v1
kind: ServiceAccount kind: ServiceAccount
metadata: metadata:
@ -9,7 +9,6 @@ metadata:
heritage: {{ .Release.Service }} heritage: {{ .Release.Service }}
release: {{ .Release.Name }} release: {{ .Release.Name }}
--- ---
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
apiVersion: rbac.authorization.k8s.io/v1 apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding kind: RoleBinding
metadata: metadata:
@ -85,4 +84,3 @@ spec:
- secret - secret
- persistentVolumeClaim - persistentVolumeClaim
{{- end }} {{- end }}
{{- end }}

View File

@ -0,0 +1,7 @@
#{{- if gt (len (lookup "rbac.authorization.k8s.io/v1" "ClusterRole" "" "")) 0 -}}
#{{- if .Values.global.cattle.psp.enabled }}
#{{- if not (.Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy") }}
#{{- fail "The target cluster does not have the PodSecurityPolicy API resource. Please disable PSPs in this chart before proceeding." -}}
#{{- end }}
#{{- end }}
#{{- end }}

View File

@ -14,6 +14,8 @@ fullnameOverride: ""
global: global:
cattle: cattle:
systemDefaultRegistry: "" systemDefaultRegistry: ""
psp:
enabled: false
defaultResources: {} defaultResources: {}
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
imagePullSecrets: [] imagePullSecrets: []