diff --git a/templates/injector-deployment.yaml b/templates/injector-deployment.yaml index 1c5b951..8c947ac 100644 --- a/templates/injector-deployment.yaml +++ b/templates/injector-deployment.yaml @@ -94,6 +94,9 @@ spec: periodSeconds: 2 successThreshold: 1 timeoutSeconds: 5 + {{- if .Values.injector.priorityClassName }} + priorityClassName: {{ .Values.injector.priorityClassName }} + {{- end }} {{- if .Values.injector.certs.secretName }} volumeMounts: - name: webhook-certs diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index 3f40709..174feee 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -158,6 +158,9 @@ spec: {{- if .Values.server.extraContainers }} {{ toYaml .Values.server.extraContainers | nindent 8}} {{- end }} + {{- if .Values.server.priorityClassName }} + priorityClassName: {{ .Values.server.priorityClassName }} + {{- end }} {{- if .Values.global.imagePullSecrets }} imagePullSecrets: {{- toYaml .Values.global.imagePullSecrets | nindent 8 }} diff --git a/test/unit/server-statefulset.bats b/test/unit/server-statefulset.bats index 3fa7ba4..1f3f2f0 100755 --- a/test/unit/server-statefulset.bats +++ b/test/unit/server-statefulset.bats @@ -872,6 +872,29 @@ load _helpers [[ "${actual}" = *"foobar"* ]] } +#-------------------------------------------------------------------- +# priorityClassName + +@test "server/standalone-StatefulSet: priorityClassName disabled by default" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-statefulset.yaml \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.priorityClassName' | tee /dev/stderr) + + [ "${actual}" = "null" ] +} + +@test "server/standalone-StatefulSet: priorityClassName enabled" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-statefulset.yaml \ + --set 'server.priorityClassName=foo' \ + . | tee /dev/stderr | + yq -r '.spec.template.spec.priorityClassName' | tee /dev/stderr) + + [ "${actual}" = "foo" ] + #-------------------------------------------------------------------- # preStop @test "server/standalone-StatefulSet: preStop sleep duration default" { diff --git a/values.yaml b/values.yaml index 2385dcc..851ef25 100644 --- a/values.yaml +++ b/values.yaml @@ -81,6 +81,11 @@ injector: # memory: 256Mi # cpu: 250m + # priorityClassName launches injector pods with a priority class. + # See: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ + # for more details. + priorityClassName: null + # extraEnvironmentVars is a list of extra enviroment variables to set in the # injector deployment. extraEnvironmentVars: {} @@ -131,6 +136,12 @@ server: # cpu: 250m # Ingress allows ingress services to be created to allow external access + # priorityClassName launches server pods with a priority class. + # See: https://kubernetes.io/docs/concepts/configuration/pod-priority-preemption/ + # for more details. + priorityClassName: null + + # Ingress allows ingress services to be created to allow external access # from Kubernetes to access Vault pods. ingress: enabled: false