Skip to content

Commit

Permalink
Kyverno policy exception
Browse files Browse the repository at this point in the history
  • Loading branch information
stone-z committed Dec 20, 2024
1 parent a1f6ae6 commit 39d7d23
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
14 changes: 14 additions & 0 deletions helm/1password-scim-bridge/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,17 @@ giantswarm.io/managed-by: {{ .Release.Name | quote }}
giantswarm.io/service-type: {{ .Values.serviceType }}
helm.sh/chart: {{ include "chart" . | quote }}
{{- end -}}

{{/*
Name used by Giant Swarm-specific helpers for this App.
*/}}
{{- define "onepassword-scim-bridge-helpers.name" -}}
{{ include "name" . | quote }}
{{- end -}}

{{/*
Labels used by Giant Swarm-specific helpers for this App.
*/}}
{{- define "onepassword-scim-bridge-helpers.labels" -}}
{{ include "labels.common" . }}
{{- end -}}
33 changes: 33 additions & 0 deletions helm/1password-scim-bridge/templates/kyverno-policy-exception.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{{- if .Values.kyvernoPolicyExceptions.enabled }}
{{- if .Capabilities.APIVersions.Has "kyverno.io/v2/PolicyException" }}
apiVersion: kyverno.io/v2
{{- else}}
apiVersion: kyverno.io/v2beta1
{{- end }}
kind: PolicyException
metadata:
name: {{ include "onepassword-scim-bridge-helpers.name" . }}-exception
namespace: {{ .Values.kyvernoPolicyExceptions.namespace | default .Release.Namespace }}
annotations:
"helm.sh/hook": "pre-install,pre-upgrade"
labels:
{{ include "onepassword-scim-bridge-helpers.labels" . | nindent 4 }}
spec:
exceptions:
- policyName: require-run-as-nonroot
ruleNames:
- autogen-run-as-non-root
- run-as-non-root
match:
any:
- resources:
kinds:
- Deployment
- ReplicaSet
- Pod
namespaces:
- {{ .Release.Namespace }}
names:
- "onepassword-scim-bridge*"
---
{{- end }}

0 comments on commit 39d7d23

Please sign in to comment.