Skip to content

Commit

Permalink
feat: add seccomp profile support
Browse files Browse the repository at this point in the history
Signed-off-by: Charles-Edouard Brétéché <[email protected]>
  • Loading branch information
eddycharly committed Feb 28, 2022
1 parent b02cd2e commit 0f520f8
Show file tree
Hide file tree
Showing 9 changed files with 34 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,12 @@ Selector labels
{{- define "ui.selectorLabels" -}}
app.kubernetes.io/name: ui
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
{{- end }}

{{- define "kyverno.securityContext" -}}
{{- if semverCompare "<1.19" .Capabilities.KubeVersion.Version }}
{{ toYaml (omit .Values.securityContext "seccompProfile") }}
{{- else }}
{{ toYaml .Values.securityContext }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions charts/policy-reporter/charts/kyvernoPlugin/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ securityContext:
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

# Key/value pairs that are attached to pods.
podAnnotations: {}
Expand Down
8 changes: 8 additions & 0 deletions charts/policy-reporter/charts/ui/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
3 changes: 1 addition & 2 deletions charts/policy-reporter/charts/ui/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions charts/policy-reporter/charts/ui/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ securityContext:
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

# Key/value pairs that are attached to pods.
podAnnotations: {}
Expand Down
8 changes: 8 additions & 0 deletions charts/policy-reporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
3 changes: 1 addition & 2 deletions charts/policy-reporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions charts/policy-reporter/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ securityContext:
capabilities:
drop:
- ALL
seccompProfile:
type: RuntimeDefault

# Key/value pairs that are attached to pods.
podAnnotations: {}
Expand Down

0 comments on commit 0f520f8

Please sign in to comment.