Skip to content

Commit 904dc99

Browse files
authored
feat: quality of life optional values to leases-cleanup job and webhook deployment (#894)
* feat: add optional resources requests and limits to cleanup job Signed-off-by: falcorocks <[email protected]> * feat: add optional podSecurity context to cleanup job Signed-off-by: falcorocks <[email protected]> * feat: add optional priorityClass to cleanup job Signed-off-by: falcorocks <[email protected]> * feat: add optional priorityClass to webhook Signed-off-by: falcorocks <[email protected]> * feat: add optional envFrom to webhook Signed-off-by: falcorocks <[email protected]> * feat: add optional automountServiceAccountToken to cleanup job Signed-off-by: falcorocks <[email protected]> * feat: add optional automountServiceAccountToken to webhook Signed-off-by: falcorocks <[email protected]> * chore: bump version Signed-off-by: falcorocks <[email protected]> --------- Signed-off-by: falcorocks <[email protected]>
1 parent 77c3659 commit 904dc99

File tree

6 files changed

+181
-2
lines changed

6 files changed

+181
-2
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.9.1
11+
version: 0.10.0
1212
appVersion: 0.12.0
1313

1414
maintainers:

charts/policy-controller/README.md

+11-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<!-- This README.md is generated. Please edit README.md.gotmpl -->
44

5-
![Version: 0.9.1](https://img.shields.io/badge/Version-0.9.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.12.0](https://img.shields.io/badge/AppVersion-0.12.0-informational?style=flat-square)
5+
![Version: 0.10.0](https://img.shields.io/badge/Version-0.10.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.12.0](https://img.shields.io/badge/AppVersion-0.12.0-informational?style=flat-square)
66

77
The Helm chart for Policy Controller
88

@@ -157,15 +157,24 @@ helm uninstall [RELEASE_NAME]
157157
| cosign.webhookTimeoutSeconds | object | `{}` | |
158158
| imagePullSecrets | list | `[]` | |
159159
| installCRDs | bool | `true` | |
160+
| leasescleanup.automountServiceAccountToken | bool | `true` | |
160161
| leasescleanup.image.pullPolicy | string | `"IfNotPresent"` | |
161162
| leasescleanup.image.repository | string | `"cgr.dev/chainguard/kubectl"` | |
162163
| leasescleanup.image.version | string | `"latest-dev"` | |
164+
| leasescleanup.podSecurityContext.enabled | bool | `false` | |
165+
| leasescleanup.priorityClass | string | `""` | |
166+
| leasescleanup.resources.limits.cpu | string | `""` | |
167+
| leasescleanup.resources.limits.memory | string | `""` | |
168+
| leasescleanup.resources.requests.cpu | string | `""` | |
169+
| leasescleanup.resources.requests.memory | string | `""` | |
163170
| loglevel | string | `"info"` | |
164171
| serviceMonitor.enabled | bool | `false` | |
165172
| webhook.affinity | object | `{}` | |
173+
| webhook.automountServiceAccountToken | bool | `true` | |
166174
| webhook.configData | object | `{}` | |
167175
| webhook.customLabels | object | `{}` | |
168176
| webhook.env | object | `{}` | |
177+
| webhook.envFrom | object | `{}` | |
169178
| webhook.extraArgs | object | `{}` | |
170179
| webhook.failurePolicy | string | `"Fail"` | |
171180
| webhook.image.pullPolicy | string | `"IfNotPresent"` | |
@@ -183,6 +192,7 @@ helm uninstall [RELEASE_NAME]
183192
| webhook.podSecurityContext.enabled | bool | `true` | |
184193
| webhook.podSecurityContext.readOnlyRootFilesystem | bool | `true` | |
185194
| webhook.podSecurityContext.runAsUser | int | `1000` | |
195+
| webhook.priorityClass | string | `""` | |
186196
| webhook.registryCaBundle | object | `{}` | |
187197
| webhook.replicaCount | int | `1` | |
188198
| webhook.resources.limits.cpu | string | `"200m"` | |

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

+35
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ spec:
1616
name: leases-cleanup
1717
spec:
1818
serviceAccountName: {{ template "webhook.serviceAccountName" . }}-cleanup
19+
{{- if .Values.leasescleanup.automountServiceAccountToken }}
20+
automountServiceAccountToken: true
21+
{{- else }}
22+
automountServiceAccountToken: false
23+
{{- end }}
1924
containers:
2025
- name: kubectl
2126
image: "{{ template "leases-cleanup.image" .Values.leasescleanup.image }}"
@@ -24,7 +29,37 @@ spec:
2429
- /bin/sh
2530
- -c
2631
- kubectl delete leases --all --ignore-not-found -n {{ .Release.Namespace }}
32+
{{- if .Values.leasescleanup.resources }}
33+
resources:
34+
{{- if .Values.leasescleanup.resources.limits }}
35+
limits:
36+
{{- if .Values.leasescleanup.resources.limits.cpu }}
37+
cpu: {{ .Values.leasescleanup.resources.limits.cpu }}
38+
{{- end }}
39+
{{- if .Values.leasescleanup.resources.limits.memory }}
40+
memory: {{ .Values.leasescleanup.resources.limits.memory }}
41+
{{- end }}
42+
{{- end }}
43+
{{- if .Values.leasescleanup.resources.requests }}
44+
requests:
45+
{{- if .Values.leasescleanup.resources.requests.cpu }}
46+
cpu: {{ .Values.leasescleanup.resources.requests.cpu }}
47+
{{- end }}
48+
{{- if .Values.leasescleanup.resources.requests.memory }}
49+
memory: {{ .Values.leasescleanup.resources.requests.memory }}
50+
{{- end }}
51+
{{- end }}
52+
{{- end }}
53+
{{- if .Values.leasescleanup.podSecurityContext.enabled }}
54+
securityContext:
55+
{{- with .Values.leasescleanup.podSecurityContext }}
56+
{{- omit . "enabled" | toYaml | nindent 12 }}
57+
{{- end }}
58+
{{- end }}
2759
restartPolicy: OnFailure
60+
{{- if .Values.leasescleanup.priorityClass }}
61+
priorityClassName: {{ .Values.leasescleanup.priorityClass }}
62+
{{- end }}
2863
---
2964
apiVersion: rbac.authorization.k8s.io/v1
3065
kind: RoleBinding

charts/policy-controller/templates/webhook/deployment_webhook.yaml

+19
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,14 @@ spec:
3131
tolerations:
3232
{{- toYaml .Values.commonTolerations | nindent 8 }}
3333
serviceAccountName: {{ include "webhook.serviceAccountName" . }}
34+
{{- if .Values.webhook.automountServiceAccountToken }}
35+
automountServiceAccountToken: true
36+
{{- else }}
37+
automountServiceAccountToken: false
38+
{{- end }}
39+
{{- if .Values.webhook.priorityClass }}
40+
priorityClassName: {{ .Values.webhook.priorityClass }}
41+
{{- end }}
3442
# To avoid node becoming SPOF, spread our replicas to different nodes.
3543
affinity:
3644
{{- if .Values.webhook.affinity }}
@@ -73,6 +81,17 @@ spec:
7381
- name: "{{ $key }}"
7482
value: "{{ $value }}"
7583
{{- end }}
84+
{{- end }}
85+
{{- if .Values.webhook.envFrom }}
86+
envFrom:
87+
{{- range $configMapName := .Values.webhook.envFrom.configmaps }}
88+
- configMapRef:
89+
name: "{{ $configMapName }}"
90+
{{- end }}
91+
{{- range $secretName := .Values.webhook.envFrom.secrets }}
92+
- secretRef:
93+
name: "{{ $secretName }}"
94+
{{- end }}
7695
{{- end }}
7796
{{- if or (semverCompare ">= 1.8-0" .Chart.AppVersion) .Values.webhook.extraArgs }}
7897
args:

charts/policy-controller/values.schema.json

+89
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
},
7070
"leasescleanup": {
7171
"properties": {
72+
"automountServiceAccountToken": {
73+
"default": true,
74+
"required": [],
75+
"title": "automountServiceAccountToken",
76+
"type": "boolean"
77+
},
7278
"image": {
7379
"properties": {
7480
"pullPolicy": {
@@ -93,6 +99,70 @@
9399
"required": [],
94100
"title": "image",
95101
"type": "object"
102+
},
103+
"podSecurityContext": {
104+
"properties": {
105+
"enabled": {
106+
"default": false,
107+
"required": [],
108+
"title": "enabled",
109+
"type": "boolean"
110+
}
111+
},
112+
"required": [],
113+
"title": "podSecurityContext",
114+
"type": "object"
115+
},
116+
"priorityClass": {
117+
"default": "",
118+
"required": [],
119+
"title": "priorityClass",
120+
"type": "string"
121+
},
122+
"resources": {
123+
"properties": {
124+
"limits": {
125+
"properties": {
126+
"cpu": {
127+
"default": "",
128+
"required": [],
129+
"title": "cpu",
130+
"type": "string"
131+
},
132+
"memory": {
133+
"default": "",
134+
"required": [],
135+
"title": "memory",
136+
"type": "string"
137+
}
138+
},
139+
"required": [],
140+
"title": "limits",
141+
"type": "object"
142+
},
143+
"requests": {
144+
"properties": {
145+
"cpu": {
146+
"default": "",
147+
"required": [],
148+
"title": "cpu",
149+
"type": "string"
150+
},
151+
"memory": {
152+
"default": "",
153+
"required": [],
154+
"title": "memory",
155+
"type": "string"
156+
}
157+
},
158+
"required": [],
159+
"title": "requests",
160+
"type": "object"
161+
}
162+
},
163+
"required": [],
164+
"title": "resources",
165+
"type": "object"
96166
}
97167
},
98168
"required": [],
@@ -127,6 +197,12 @@
127197
"title": "affinity",
128198
"type": "object"
129199
},
200+
"automountServiceAccountToken": {
201+
"default": true,
202+
"required": [],
203+
"title": "automountServiceAccountToken",
204+
"type": "boolean"
205+
},
130206
"configData": {
131207
"required": [],
132208
"title": "configData",
@@ -142,7 +218,13 @@
142218
"title": "env",
143219
"type": "object"
144220
},
221+
"envFrom": {
222+
"required": [],
223+
"title": "envFrom",
224+
"type": "object"
225+
},
145226
"extraArgs": {
227+
"description": "configmaps:\n - mycm1\n - mycm2\nsecrets:\n - mys1\n - mys2",
146228
"required": [],
147229
"title": "extraArgs",
148230
"type": "object"
@@ -310,6 +392,13 @@
310392
"title": "podSecurityContext",
311393
"type": "object"
312394
},
395+
"priorityClass": {
396+
"default": "",
397+
"description": "defaulting: 10\nvalidating: 10",
398+
"required": [],
399+
"title": "priorityClass",
400+
"type": "string"
401+
},
313402
"registryCaBundle": {
314403
"required": [],
315404
"title": "registryCaBundle",

charts/policy-controller/values.yaml

+26
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,13 @@ webhook:
2323
version: sha256:6b51f336dec9e9adff29606855dbd2c7910c5eb80d6579795a29cb3844428efc
2424
pullPolicy: IfNotPresent
2525
env: {}
26+
envFrom: {}
27+
# configmaps:
28+
# - mycm1
29+
# - mycm2
30+
# secrets:
31+
# - mys1
32+
# - mys2
2633
extraArgs: {}
2734
resources:
2835
limits:
@@ -76,12 +83,31 @@ webhook:
7683
webhookTimeoutSeconds: {}
7784
# defaulting: 10
7885
# validating: 10
86+
priorityClass: ""
87+
automountServiceAccountToken: true
7988

8089
leasescleanup:
90+
priorityClass: ""
8191
image:
8292
repository: cgr.dev/chainguard/kubectl
8393
version: latest-dev
8494
pullPolicy: IfNotPresent
95+
resources:
96+
limits:
97+
cpu: ""
98+
memory: ""
99+
requests:
100+
cpu: ""
101+
memory: ""
102+
podSecurityContext:
103+
enabled: false
104+
# allowPrivilegeEscalation: false
105+
# readOnlyRootFilesystem: true
106+
# runAsUser: 1000
107+
# capabilities:
108+
# drop:
109+
# - ALL
110+
automountServiceAccountToken: true
85111

86112
## common node selector for all the pods
87113
commonNodeSelector: {}

0 commit comments

Comments
 (0)