diff --git a/charts/policy-reporter/charts/kyvernoPlugin/templates/_helpers.tpl b/charts/policy-reporter/charts/kyvernoPlugin/templates/_helpers.tpl index 19e983d5f..a6b09e66b 100644 --- a/charts/policy-reporter/charts/kyvernoPlugin/templates/_helpers.tpl +++ b/charts/policy-reporter/charts/kyvernoPlugin/templates/_helpers.tpl @@ -65,4 +65,12 @@ Selector labels {{- define "ui.selectorLabels" -}} app.kubernetes.io/name: ui app.kubernetes.io/instance: {{ .Release.Name }} -{{- end }} \ No newline at end of file +{{- end }} + +{{- define "kyverno.securityContext" -}} +{{- if semverCompare "<1.19" .Capabilities.KubeVersion.Version }} +{{ toYaml (omit .Values.securityContext "seccompProfile") }} +{{- else }} +{{ toYaml .Values.securityContext }} +{{- end }} +{{- end }} diff --git a/charts/policy-reporter/charts/kyvernoPlugin/templates/deployment.yaml b/charts/policy-reporter/charts/kyvernoPlugin/templates/deployment.yaml index 1fc5e73c8..0f0fa88d1 100644 --- a/charts/policy-reporter/charts/kyvernoPlugin/templates/deployment.yaml +++ b/charts/policy-reporter/charts/kyvernoPlugin/templates/deployment.yaml @@ -41,8 +41,7 @@ spec: image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.securityContext }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + securityContext: {{ include "kyverno.securityContext" . | nindent 12 }} {{- end }} args: - --port=8080 diff --git a/charts/policy-reporter/charts/kyvernoPlugin/values.yaml b/charts/policy-reporter/charts/kyvernoPlugin/values.yaml index 5083ce264..112fc6fb5 100644 --- a/charts/policy-reporter/charts/kyvernoPlugin/values.yaml +++ b/charts/policy-reporter/charts/kyvernoPlugin/values.yaml @@ -51,6 +51,8 @@ securityContext: capabilities: drop: - ALL + seccompProfile: + type: RuntimeDefault # Key/value pairs that are attached to pods. podAnnotations: {} diff --git a/charts/policy-reporter/charts/ui/templates/_helpers.tpl b/charts/policy-reporter/charts/ui/templates/_helpers.tpl index dc4b03812..4282584d2 100644 --- a/charts/policy-reporter/charts/ui/templates/_helpers.tpl +++ b/charts/policy-reporter/charts/ui/templates/_helpers.tpl @@ -101,3 +101,11 @@ Create the name of the service account to use {{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} {{- end }} {{- end }} + +{{- define "kyverno.securityContext" -}} +{{- if semverCompare "<1.19" .Capabilities.KubeVersion.Version }} +{{ toYaml (omit .Values.securityContext "seccompProfile") }} +{{- else }} +{{ toYaml .Values.securityContext }} +{{- end }} +{{- end }} diff --git a/charts/policy-reporter/charts/ui/templates/deployment.yaml b/charts/policy-reporter/charts/ui/templates/deployment.yaml index b72f6b7ad..a663c0d17 100644 --- a/charts/policy-reporter/charts/ui/templates/deployment.yaml +++ b/charts/policy-reporter/charts/ui/templates/deployment.yaml @@ -40,8 +40,7 @@ spec: image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.securityContext }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + securityContext: {{ include "kyverno.securityContext" . | nindent 12 }} {{- end }} args: - -config=/app/config.yaml diff --git a/charts/policy-reporter/charts/ui/values.yaml b/charts/policy-reporter/charts/ui/values.yaml index d88f1ce99..763680521 100644 --- a/charts/policy-reporter/charts/ui/values.yaml +++ b/charts/policy-reporter/charts/ui/values.yaml @@ -35,6 +35,8 @@ securityContext: capabilities: drop: - ALL + seccompProfile: + type: RuntimeDefault # Key/value pairs that are attached to pods. podAnnotations: {} diff --git a/charts/policy-reporter/templates/_helpers.tpl b/charts/policy-reporter/templates/_helpers.tpl index c53595caa..c55ba8938 100644 --- a/charts/policy-reporter/templates/_helpers.tpl +++ b/charts/policy-reporter/templates/_helpers.tpl @@ -73,3 +73,11 @@ Create UI target host based on configuration {{- "" }} {{- end }} {{- end }} + +{{- define "kyverno.securityContext" -}} +{{- if semverCompare "<1.19" .Capabilities.KubeVersion.Version }} +{{ toYaml (omit .Values.securityContext "seccompProfile") }} +{{- else }} +{{ toYaml .Values.securityContext }} +{{- end }} +{{- end }} diff --git a/charts/policy-reporter/templates/deployment.yaml b/charts/policy-reporter/templates/deployment.yaml index f33e58f0f..d7c2b48d7 100644 --- a/charts/policy-reporter/templates/deployment.yaml +++ b/charts/policy-reporter/templates/deployment.yaml @@ -48,8 +48,7 @@ spec: image: "{{ .Values.image.registry }}/{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" imagePullPolicy: {{ .Values.image.pullPolicy }} {{- if .Values.securityContext }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} + securityContext: {{ include "kyverno.securityContext" . | nindent 12 }} {{- end }} args: - --config=/app/config.yaml diff --git a/charts/policy-reporter/values.yaml b/charts/policy-reporter/values.yaml index 0d6c9a41e..1e56ccac0 100644 --- a/charts/policy-reporter/values.yaml +++ b/charts/policy-reporter/values.yaml @@ -56,6 +56,8 @@ securityContext: capabilities: drop: - ALL + seccompProfile: + type: RuntimeDefault # Key/value pairs that are attached to pods. podAnnotations: {}