Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leases cleanup add security context #817

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/policy-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ sources:
type: application

name: policy-controller
version: 0.6.9
version: 0.6.10
appVersion: 0.8.2

maintainers:
Expand Down
8 changes: 8 additions & 0 deletions charts/policy-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | `{}` | |
Expand Down
12 changes: 12 additions & 0 deletions charts/policy-controller/templates/webhook/cleanup-leases.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions charts/policy-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: {}
Expand Down