Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support setting priorityClassName on pods #282

Merged
merged 1 commit into from
May 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions templates/injector-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ spec:
{{ template "injector.affinity" . }}
{{ template "injector.tolerations" . }}
{{ template "injector.nodeselector" . }}
{{- if .Values.injector.priorityClassName }}
priorityClassName: {{ .Values.injector.priorityClassName }}
{{- end }}
serviceAccountName: "{{ template "vault.fullname" . }}-agent-injector"
securityContext:
runAsNonRoot: true
Expand Down
3 changes: 3 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ spec:
{{ template "vault.affinity" . }}
{{ template "vault.tolerations" . }}
{{ template "vault.nodeselector" . }}
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName }}
{{- end }}
terminationGracePeriodSeconds: 10
serviceAccountName: {{ template "vault.fullname" . }}
{{ if .Values.server.shareProcessNamespace }}
Expand Down
22 changes: 22 additions & 0 deletions test/unit/injector-deployment.bats
Original file line number Diff line number Diff line change
Expand Up @@ -425,3 +425,25 @@ load _helpers
yq -r '.spec.template.spec.nodeSelector' | tee /dev/stderr)
[ "${actual}" = "testing" ]
}

#--------------------------------------------------------------------
# priorityClassName

@test "injector/deployment: priorityClassName not set by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-deployment.yaml \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName? == null' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "injector/deployment: priorityClassName can be set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/injector-deployment.yaml \
--set 'injector.priorityClassName=armaggeddon' \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName == "armaggeddon"' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
26 changes: 24 additions & 2 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -711,7 +711,7 @@ load _helpers
. | tee /dev/stderr |
yq -r '.spec.template.spec.shareProcessNamespace' | tee /dev/stderr)

[ "${actual}" = "null" ]
[ "${actual}" = "null" ]
}

@test "server/standalone-StatefulSet: shareProcessNamespace enabled" {
Expand All @@ -724,7 +724,7 @@ load _helpers
. | tee /dev/stderr |
yq -r '.spec.template.spec.shareProcessNamespace' | tee /dev/stderr)

[ "${actual}" = "true" ]
[ "${actual}" = "true" ]
}

# extra labels
Expand Down Expand Up @@ -958,3 +958,25 @@ load _helpers
yq -r '.spec.template.metadata.annotations["vaultIsAwesome"]' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# priorityClassName

@test "server/standalone-StatefulSet: priorityClassName not set by default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName? == null' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

@test "server/standalone-StatefulSet: priorityClassName can be set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.priorityClassName=armaggeddon' \
. | tee /dev/stderr |
yq '.spec.template.spec | .priorityClassName == "armaggeddon"' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ injector:
# beta.kubernetes.io/arch: amd64
nodeSelector: null

# Priority class for injector pods
priorityClassName: ""

server:
# Resource requests, limits, etc. for the server cluster placement. This
# should map directly to the value of the resources field for a PodSpec.
Expand Down Expand Up @@ -227,6 +230,9 @@ server:
# beta.kubernetes.io/arch: amd64
nodeSelector: {}

# Priority class for server pods
priorityClassName: ""

# Extra labels to attach to the server pods
# This should be a multi-line string mapping directly to the a map of
# the labels to apply to the server pods
Expand Down