Skip to content

Commit

Permalink
Add node selection ability for webhook helm tests
Browse files Browse the repository at this point in the history
Signed-off-by: David McDaniel <[email protected]>
Signed-off-by: David McDaniel <[email protected]>
  • Loading branch information
dmcdii authored and WanzenBug committed Nov 14, 2023
1 parent 88d05f1 commit f40542a
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 0 deletions.
3 changes: 3 additions & 0 deletions charts/snapshot-controller/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ available.
| `webhook.affinity` | Affinity to set on each webhook pod. | `{}` |
| `webhook.serviceAccount.create` | Create the service account resource | `true` |
| `webhook.serviceAccount.name` | Sets the name of the service account. If left empty, will use the release name as default | `""` |
| `webhook.tests.nodeSelector` | Node selector to add to each helm test pod. | `{}` |
| `webhook.tests.tolerations` | Tolerations to add to each helm test pod. | `[]` |
| `webhook.tests.affinity` | Affinity to set on each helm test pod. | `{}` |


[`3.x.x` releases]: https://github.com/kubernetes-csi/external-snapshotter/releases
Expand Down
12 changes: 12 additions & 0 deletions charts/snapshot-controller/templates/tests/test-invalid-body.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@ spec:
- -exc
- |
curl -kfsS -X POST -H 'Content-Type: application/json' -d '{{ .Files.Get "tests/invalid-admission.json" | trim }}' https://{{ include "snapshot-validation-webhook.fullname" . }}/volumesnapshot | grep -c '"allowed":false'
{{- with .Values.webhook.tests.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.webhook.tests.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.webhook.tests.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
restartPolicy: Never
{{- end }}
12 changes: 12 additions & 0 deletions charts/snapshot-controller/templates/tests/test-valid-body.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,17 @@ spec:
- -exc
- |
curl -kfsS -X POST -H 'Content-Type: application/json' -d '{{ .Files.Get "tests/valid-admission.json" | trim }}' https://{{ include "snapshot-validation-webhook.fullname" . }}/volumesnapshot | grep -c '"allowed":true'
{{- with .Values.webhook.tests.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.webhook.tests.affinity }}
affinity:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- with .Values.webhook.tests.tolerations }}
tolerations:
{{- toYaml . | nindent 4 }}
{{- end }}
restartPolicy: Never
{{- end }}
7 changes: 7 additions & 0 deletions charts/snapshot-controller/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -150,3 +150,10 @@ webhook:

rbac:
create: true

tests:
nodeSelector: { }

tolerations: [ ]

affinity: { }

0 comments on commit f40542a

Please sign in to comment.