fix: psp usage for kube 1.25 and higher

ref https://github.com/rancher/rancher/issues/39858
pull/2247/head
Andreas Kupries 2022-12-15 09:47:21 +01:00
parent d5b1974699
commit d6ebecef8c
6 changed files with 16 additions and 4 deletions

View File

@ -1,4 +1,5 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" -}}
{{- if .Values.serviceAccount.create }}
{{- if .Values.global.rbac.pspEnabled }}
---
@ -80,5 +81,6 @@ subjects:
name: {{ .Values.serviceAccount.name | quote }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end -}}

View File

@ -1,3 +1,4 @@
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" -}}
{{- if .Values.global.rbac.pspEnabled }}
apiVersion: v1
@ -86,3 +87,4 @@ subjects:
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end -}}

View File

@ -1,6 +1,6 @@
--- charts-original/templates/server.yaml
+++ charts/templates/server.yaml
@@ -30,6 +30,13 @@
@@ -30,6 +30,15 @@
labels:
{{- include "epinio-ui.labels" . | nindent 8 }}
spec:
@ -8,8 +8,10 @@
+ {{- include "linux-node-selector" . | nindent 8 }}
+ tolerations:
+ {{- include "linux-node-tolerations" . | nindent 8 }}
+{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" }}
+{{- if .Values.global.rbac.pspEnabled }}
+ serviceAccountName: epinio-ui
+{{- end }}
+{{- end }}
containers:
- name: epinio-ui

View File

@ -1,3 +1,4 @@
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" -}}
{{- if .Values.global.rbac.pspEnabled }}
apiVersion: policy/v1beta1
@ -79,3 +80,4 @@ subjects:
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end -}}

View File

@ -1,4 +1,5 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" -}}
{{- if .Values.serviceAccount.create }}
{{- if .Values.global.rbac.pspEnabled }}
---
@ -80,5 +81,6 @@ subjects:
name: {{ include "kubed.serviceAccountName" . }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end -}}

View File

@ -1,4 +1,5 @@
{{- if .Values.serviceAccount.create -}}
{{- if .Capabilities.APIVersions.Has "policy/v1beta1/PodSecurityPolicy" -}}
{{- if .Values.serviceAccount.create }}
{{- if .Values.global.rbac.pspEnabled }}
---
@ -80,5 +81,6 @@ subjects:
name: {{ .Values.serviceAccount.name | quote }}
namespace: {{ .Release.Namespace }}
{{- end }}
{{- end }}
{{- end -}}