diff --git a/charts/policy-controller/README.md b/charts/policy-controller/README.md index c64cb857..c1925ae1 100644 --- a/charts/policy-controller/README.md +++ b/charts/policy-controller/README.md @@ -159,6 +159,14 @@ helm uninstall [RELEASE_NAME] | leasescleanup.image.pullPolicy | string | `"IfNotPresent"` | | | leasescleanup.image.repository | string | `"cgr.dev/chainguard/kubectl"` | | | leasescleanup.image.version | string | `"latest-dev"` | | +| leasescleanup.podSecurityContext.allowPrivilegeEscalation | bool | `false` | | +| leasescleanup.podSecurityContext.capabilities.drop[0] | string | `"ALL"` | | +| leasescleanup.podSecurityContext.enabled | bool | `true` | | +| leasescleanup.podSecurityContext.readOnlyRootFilesystem | bool | `true` | | +| leasescleanup.podSecurityContext.runAsUser | int | `1000` | | +| leasescleanup.securityContext.enabled | bool | `false` | | +| leasescleanup.securityContext.runAsNonRoot | bool | `true` | | +| leasescleanup.securityContext.runAsUser | int | `1000` | | | loglevel | string | `"info"` | | | serviceMonitor.enabled | bool | `false` | | | webhook.configData | object | `{}` | | diff --git a/charts/policy-controller/templates/webhook/cleanup-leases.yaml b/charts/policy-controller/templates/webhook/cleanup-leases.yaml index 0cccbb16..c05d8d1c 100644 --- a/charts/policy-controller/templates/webhook/cleanup-leases.yaml +++ b/charts/policy-controller/templates/webhook/cleanup-leases.yaml @@ -24,6 +24,18 @@ spec: - /bin/sh - -c - kubectl delete leases --all --ignore-not-found -n {{ .Release.Namespace }} + {{- if .Values.leasescleanup.podSecurityContext.enabled }} + securityContext: + {{- with .Values.leasescleanup.podSecurityContext }} + {{- omit . "enabled" | toYaml | nindent 10}} + {{- end }} + {{- end }} + {{- if .Values.leasescleanup.securityContext.enabled }} + securityContext: + {{- with .Values.leasescleanup.securityContext }} + {{- omit . "enabled" | toYaml | nindent 8}} + {{- end }} + {{- end }} restartPolicy: OnFailure --- apiVersion: rbac.authorization.k8s.io/v1 diff --git a/charts/policy-controller/values.yaml b/charts/policy-controller/values.yaml index c9627e3a..1855a5e7 100644 --- a/charts/policy-controller/values.yaml +++ b/charts/policy-controller/values.yaml @@ -72,6 +72,18 @@ leasescleanup: repository: cgr.dev/chainguard/kubectl version: latest-dev pullPolicy: IfNotPresent + securityContext: + enabled: false + runAsUser: 1000 + runAsNonRoot: true + podSecurityContext: + enabled: true + allowPrivilegeEscalation: false + readOnlyRootFilesystem: true + runAsUser: 1000 + capabilities: + drop: + - ALL ## common node selector for all the pods commonNodeSelector: {}