From 0043023c097b22462774e516c71e91ed308a8b46 Mon Sep 17 00:00:00 2001 From: Vadim Grek Date: Wed, 5 Jan 2022 00:10:56 +0200 Subject: [PATCH] csi: ability to set priorityClassName for csi daemonset pods (#670) --- CHANGELOG.md | 1 + templates/csi-daemonset.yaml | 3 +++ test/unit/csi-daemonset.bats | 23 +++++++++++++++++++++++ values.schema.json | 3 +++ values.yaml | 3 +++ 5 files changed, 33 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 38cb066..a8fa037 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Features: * Added configurable podDisruptionBudget for injector [GH-653](https://github.com/hashicorp/vault-helm/pull/653) * Make terminationGracePeriodSeconds configurable for server [GH-659](https://github.com/hashicorp/vault-helm/pull/659) * Added configurable update strategy for injector [GH-661](https://github.com/hashicorp/vault-helm/pull/661) +* csi: ability to set priorityClassName for CSI daemonset pods [GH-670](https://github.com/hashicorp/vault-helm/pull/670) ## 0.18.0 (November 17th, 2021) diff --git a/templates/csi-daemonset.yaml b/templates/csi-daemonset.yaml index a6461fb..f0bf639 100644 --- a/templates/csi-daemonset.yaml +++ b/templates/csi-daemonset.yaml @@ -27,6 +27,9 @@ spec: app.kubernetes.io/instance: {{ .Release.Name }} {{ template "csi.pod.annotations" . }} spec: + {{- if .Values.csi.priorityClassName }} + priorityClassName: {{ .Values.csi.priorityClassName }} + {{- end }} serviceAccountName: {{ template "vault.fullname" . }}-csi-provider {{- template "csi.pod.tolerations" . }} containers: diff --git a/test/unit/csi-daemonset.bats b/test/unit/csi-daemonset.bats index 5cfd8a7..dd88d82 100644 --- a/test/unit/csi-daemonset.bats +++ b/test/unit/csi-daemonset.bats @@ -30,6 +30,29 @@ load _helpers [ "${actual}" = "false" ] } +# priorityClassName + +@test "csi/daemonset: priorityClassName not set by default" { + cd `chart_dir` + local actual=$(helm template \ + --show-only templates/csi-daemonset.yaml \ + --set "csi.enabled=true" \ + . | tee /dev/stderr | + yq '.spec.template.spec | .priorityClassName? == null' | tee /dev/stderr) + [ "${actual}" = "true" ] +} + +@test "csi/daemonset: priorityClassName can be set" { + cd `chart_dir` + local actual=$(helm template \ + --show-only templates/csi-daemonset.yaml \ + --set 'csi.priorityClassName=armaggeddon' \ + --set "csi.enabled=true" \ + . | tee /dev/stderr | + yq '.spec.template.spec | .priorityClassName == "armaggeddon"' | tee /dev/stderr) + [ "${actual}" = "true" ] +} + # serviceAccountName reference name @test "csi/daemonset: serviceAccountName reference name" { cd `chart_dir` diff --git a/values.schema.json b/values.schema.json index 5ef61e7..1544043 100644 --- a/values.schema.json +++ b/values.schema.json @@ -33,6 +33,9 @@ } } }, + "priorityClassName": { + "type": "string" + }, "debug": { "type": "boolean" }, diff --git a/values.yaml b/values.yaml index 6f88ff8..a6704db 100644 --- a/values.yaml +++ b/values.yaml @@ -812,6 +812,9 @@ csi: # in a PodSpec. tolerations: [] + # Priority class for csi pods + priorityClassName: "" + serviceAccount: # Extra annotations for the serviceAccount definition. This can either be # YAML or a YAML-formatted multi-line templated string map of the