Skip to content

Commit 4125424

Browse files
Make cleanup-leases security context configurable
The SecurityContext field for this job is currently static, however when deploying policy-controller into a namespace that uses Pod Security Admission controllers this job will not be able to run. Signed-off-by: Simon Witheridge <[email protected]>
1 parent 0c5e7b7 commit 4125424

File tree

5 files changed

+36
-12
lines changed

5 files changed

+36
-12
lines changed

charts/policy-controller/Chart.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sources:
88
type: application
99

1010
name: policy-controller
11-
version: 0.6.1
11+
version: 0.7.0
1212
appVersion: 0.8.2
1313

1414
maintainers:

charts/policy-controller/README.md

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# policy-controller
22

3-
![Version: 0.5.8](https://img.shields.io/badge/Version-0.5.8-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.7.0](https://img.shields.io/badge/AppVersion-0.7.0-informational?style=flat-square)
3+
![Version: 0.7.0](https://img.shields.io/badge/Version-0.6.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.8.2](https://img.shields.io/badge/AppVersion-0.8.2-informational?style=flat-square)
44

55
The Helm chart for Policy Controller
66

@@ -27,17 +27,19 @@ The Helm chart for Policy Controller
2727
| cosign.webhookName | string | `"policy.sigstore.dev"` | |
2828
| imagePullSecrets | list | `[]` | |
2929
| installCRDs | bool | `true` | |
30-
| webhook.configData | object | `{}` | Set the data of the `policy-config-controller` configmap |
31-
| webhook.webhookNames.defaulting | string | `"defaulting.clusterimagepolicy.sigstore.dev"` | |
32-
| webhook.webhookNames.validating | string | `"validating.clusterimagepolicy.sigstore.dev"` | |
30+
| leasescleanup.image.pullPolicy | string | `"IfNotPresent"` | |
31+
| leasescleanup.image.repository | string | `"cgr.dev/chainguard/kubectl"` | |
32+
| leasescleanup.image.version | string | `"1.26.0"` | |
33+
| leasescleanup.securityContext.enabled | bool | `false` | |
3334
| serviceMonitor.enabled | bool | `false` | |
35+
| webhook.configData | object | `{}` | |
3436
| webhook.env | object | `{}` | |
3537
| webhook.extraArgs | object | `{}` | |
38+
| webhook.failurePolicy | string | `"Fail"` | |
3639
| webhook.image.pullPolicy | string | `"IfNotPresent"` | |
3740
| webhook.image.repository | string | `"ghcr.io/sigstore/policy-controller/policy-controller"` | |
38-
| webhook.image.version | string | `"sha256:e91bcd954394b414d3b80adfc2cefdae84dd7985fb938a895471eb34aac57744"` | `"v0.8.0"` |
41+
| webhook.image.version | string | `"sha256:e91bcd954394b414d3b80adfc2cefdae84dd7985fb938a895471eb34aac57744"` | |
3942
| webhook.name | string | `"webhook"` | |
40-
| webhook.failurePolicy | string | `"Fail"` | |
4143
| webhook.namespaceSelector.matchExpressions[0].key | string | `"policy.sigstore.dev/include"` | |
4244
| webhook.namespaceSelector.matchExpressions[0].operator | string | `"In"` | |
4345
| webhook.namespaceSelector.matchExpressions[0].values[0] | string | `"true"` | |
@@ -48,8 +50,8 @@ The Helm chart for Policy Controller
4850
| webhook.podSecurityContext.runAsUser | int | `1000` | |
4951
| webhook.registryCaBundle | object | `{}` | |
5052
| webhook.replicaCount | int | `1` | |
51-
| webhook.resources.limits.cpu | string | `"100m"` | |
52-
| webhook.resources.limits.memory | string | `"256Mi"` | |
53+
| webhook.resources.limits.cpu | string | `"200m"` | |
54+
| webhook.resources.limits.memory | string | `"512Mi"` | |
5355
| webhook.resources.requests.cpu | string | `"100m"` | |
5456
| webhook.resources.requests.memory | string | `"128Mi"` | |
5557
| webhook.securityContext.enabled | bool | `false` | |
@@ -62,9 +64,8 @@ The Helm chart for Policy Controller
6264
| webhook.serviceAccount.name | string | `""` | |
6365
| webhook.volumeMounts | list | `[]` | |
6466
| webhook.volumes | list | `[]` | |
65-
| leasescleanup.image.pullPolicy | string | `"IfNotPresent"` | |
66-
| leasescleanup.image.repository | string | `"cgr.dev/chainguard/kubectl"` | |
67-
| leasescleanup.image.version | string | `"1.26.0"` | |
67+
| webhook.webhookNames.defaulting | string | `"defaulting.clusterimagepolicy.sigstore.dev"` | |
68+
| webhook.webhookNames.validating | string | `"validating.clusterimagepolicy.sigstore.dev"` | |
6869

6970
### Deploy `policy-controller` Helm Chart
7071

charts/policy-controller/templates/webhook/cleanup-leases.yaml

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ spec:
2525
- -c
2626
- kubectl delete leases --all --ignore-not-found -n {{ .Release.Namespace }}
2727
restartPolicy: OnFailure
28+
{{- if .Values.leasescleanup.securityContext.enabled }}
29+
securityContext:
30+
{{- with .Values.leasescleanup.securityContext }}
31+
{{- omit . "enabled" | toYaml | nindent 8}}
32+
{{- end }}
33+
{{- end }}
2834
---
2935
apiVersion: rbac.authorization.k8s.io/v1
3036
kind: RoleBinding

charts/policy-controller/values.schema.json

+8
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@
4242
}
4343
}
4444
}
45+
},
46+
"securityContext": {
47+
"type": "object",
48+
"properties": {
49+
"enabled": {
50+
"type": "boolean"
51+
}
52+
}
4553
}
4654
},
4755
"serviceMonitor": {

charts/policy-controller/values.yaml

+9
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,15 @@ leasescleanup:
6565
repository: cgr.dev/chainguard/kubectl
6666
version: 1.26.0
6767
pullPolicy: IfNotPresent
68+
## set pod security context options to harden the pod or allow exceptions
69+
securityContext:
70+
enabled: false
71+
# allowPrivilegeEscalation: false
72+
# readOnlyRootFilesystem: true
73+
# runAsUser: 1000
74+
# capabilities:
75+
# drop:
76+
# - ALL
6877

6978
## common node selector for all the pods
7079
commonNodeSelector: {}

0 commit comments

Comments
 (0)