Skip to content

Commit d904d8f

Browse files
authored
Add priorityclassname Support and Test (#160)
* add priorityClassName * add test * indentation
1 parent 628c207 commit d904d8f

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

charts/k8s-service/templates/_deployment_spec.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,11 @@ spec:
433433
{{ toYaml . | indent 8 }}
434434
{{- end }}
435435
436+
{{- with .Values.priorityClassName }}
437+
priorityClassName:
438+
{{ toYaml . | indent 8 }}
439+
{{- end }}
440+
436441
{{- with .Values.tolerations }}
437442
tolerations:
438443
{{ toYaml . | indent 8 }}

charts/k8s-service/values.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -637,6 +637,10 @@ containerResources: {}
637637
nodeSelector: {}
638638
affinity: {}
639639

640+
# priorityClassName assigns a priorityClass to the deployment allowing pods to preempt or be preempted.
641+
# See https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#priorityclass
642+
priorityClassName: {}
643+
640644
# tolerations can be used to allow the pod to be scheduled on nodes with a specific taint.
641645
# NOTE: This variable is injected directly into the pod spec. See the official documentation for what this might look
642646
# like: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/

test/k8s_service_config_injection_template_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,20 @@ import (
1818
corev1 "k8s.io/api/core/v1"
1919
)
2020

21+
// Test that setting the `priorityClassName` input value will include priorityClassName in the pod spec of the deployment
22+
func TestK8sServicePriorityClassName(t *testing.T) {
23+
t.Parallel()
24+
25+
deployment := renderK8SServiceDeploymentWithSetValues(
26+
t,
27+
map[string]string{
28+
"priorityClassName": "testPriorityClass",
29+
},
30+
)
31+
renderedPriorityClassName := deployment.Spec.Template.Spec.PriorityClassName
32+
require.Equal(t, renderedPriorityClassName, "testPriorityClass")
33+
}
34+
2135
// Test that setting the `envVars` input value to empty object leaves env vars out of the pod.
2236
func TestK8SServiceEnvVarConfigMapsSecretsEmptyDoesNotAddEnvVarsAndVolumesToPod(t *testing.T) {
2337
t.Parallel()

0 commit comments

Comments
 (0)