Compare commits
10 commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4c752a9f1d | ||
![]() |
fb3126b864 | ||
![]() |
b67a874090 | ||
![]() |
102c29955b | ||
![]() |
567a4386a5 | ||
![]() |
f49ecb6802 | ||
![]() |
8840187301 | ||
![]() |
87c3e62030 | ||
![]() |
c77cb1f6a4 | ||
![]() |
18f8db05d9 |
8 changed files with 122 additions and 0 deletions
|
@ -293,6 +293,37 @@ Sets the injector affinity for pod placement
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{- end -}}
|
{{- end -}}
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Sets the topologySpreadConstraints when running in standalone and HA modes.
|
||||||
|
*/}}
|
||||||
|
{{- define "vault.topologySpreadConstraints" -}}
|
||||||
|
{{- if and (ne .mode "dev") .Values.server.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{ $tp := typeOf .Values.server.topologySpreadConstraints }}
|
||||||
|
{{- if eq $tp "string" }}
|
||||||
|
{{- tpl .Values.server.topologySpreadConstraints . | nindent 8 | trim }}
|
||||||
|
{{- else }}
|
||||||
|
{{- toYaml .Values.server.topologySpreadConstraints | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
|
|
||||||
|
{{/*
|
||||||
|
Sets the injector topologySpreadConstraints for pod placement
|
||||||
|
*/}}
|
||||||
|
{{- define "injector.topologySpreadConstraints" -}}
|
||||||
|
{{- if .Values.injector.topologySpreadConstraints }}
|
||||||
|
topologySpreadConstraints:
|
||||||
|
{{ $tp := typeOf .Values.injector.topologySpreadConstraints }}
|
||||||
|
{{- if eq $tp "string" }}
|
||||||
|
{{- tpl .Values.injector.topologySpreadConstraints . | nindent 8 | trim }}
|
||||||
|
{{- else }}
|
||||||
|
{{- toYaml .Values.injector.topologySpreadConstraints | nindent 8 }}
|
||||||
|
{{- end }}
|
||||||
|
{{ end }}
|
||||||
|
{{- end -}}
|
||||||
|
|
||||||
{{/*
|
{{/*
|
||||||
Sets the toleration for pod placement when running in standalone and HA modes.
|
Sets the toleration for pod placement when running in standalone and HA modes.
|
||||||
*/}}
|
*/}}
|
||||||
|
|
|
@ -31,6 +31,7 @@ spec:
|
||||||
{{ template "injector.annotations" . }}
|
{{ template "injector.annotations" . }}
|
||||||
spec:
|
spec:
|
||||||
{{ template "injector.affinity" . }}
|
{{ template "injector.affinity" . }}
|
||||||
|
{{ template "injector.topologySpreadConstraints" . }}
|
||||||
{{ template "injector.tolerations" . }}
|
{{ template "injector.tolerations" . }}
|
||||||
{{ template "injector.nodeselector" . }}
|
{{ template "injector.nodeselector" . }}
|
||||||
{{- if .Values.injector.priorityClassName }}
|
{{- if .Values.injector.priorityClassName }}
|
||||||
|
|
|
@ -37,6 +37,7 @@ spec:
|
||||||
{{ template "vault.annotations" . }}
|
{{ template "vault.annotations" . }}
|
||||||
spec:
|
spec:
|
||||||
{{ template "vault.affinity" . }}
|
{{ template "vault.affinity" . }}
|
||||||
|
{{ template "vault.topologySpreadConstraints" . }}
|
||||||
{{ template "vault.tolerations" . }}
|
{{ template "vault.tolerations" . }}
|
||||||
{{ template "vault.nodeselector" . }}
|
{{ template "vault.nodeselector" . }}
|
||||||
{{- if .Values.server.priorityClassName }}
|
{{- if .Values.server.priorityClassName }}
|
||||||
|
|
|
@ -462,6 +462,27 @@ load _helpers
|
||||||
[ "${actual}" = "true" ]
|
[ "${actual}" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# topologySpreadConstraints
|
||||||
|
|
||||||
|
@test "injector/deployment: topologySpreadConstraints is null by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/injector-deployment.yaml \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "injector/deployment: topologySpreadConstraints can be set as YAML" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/injector-deployment.yaml \
|
||||||
|
--set "injector.topologySpreadConstraints[0].foo=bar,injector.topologySpreadConstraints[1].baz=qux" \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec.topologySpreadConstraints == [{"foo": "bar"}, {"baz": "qux"}]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "true" ]
|
||||||
|
}
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
# tolerations
|
# tolerations
|
||||||
|
|
||||||
|
|
|
@ -585,6 +585,32 @@ load _helpers
|
||||||
[ "${actual}" = "1" ]
|
[ "${actual}" = "1" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# topologySpreadConstraints
|
||||||
|
|
||||||
|
@test "server/ha-StatefulSet: topologySpreadConstraints is null by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/ha-StatefulSet: topologySpreadConstraints can be set as YAML" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
--set "server.topologySpreadConstraints[0].foo=bar,server.topologySpreadConstraints[1].baz=qux" \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec.topologySpreadConstraints == [{"foo": "bar"}, {"baz": "qux"}]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "true" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# tolerations
|
||||||
|
|
||||||
@test "server/ha-StatefulSet: tolerations not set by default" {
|
@test "server/ha-StatefulSet: tolerations not set by default" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
local actual=$(helm template \
|
local actual=$(helm template \
|
||||||
|
|
|
@ -784,6 +784,29 @@ load _helpers
|
||||||
[ "${actual}" = "true" ]
|
[ "${actual}" = "true" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# topologySpreadConstraints
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: topologySpreadConstraints is null by default" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec | .topologySpreadConstraints? == null' | tee /dev/stderr)
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/standalone-StatefulSet: topologySpreadConstraints can be set as YAML" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
--show-only templates/server-statefulset.yaml \
|
||||||
|
--set "server.topologySpreadConstraints[0].foo=bar,server.topologySpreadConstraints[1].baz=qux" \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq '.spec.template.spec.topologySpreadConstraints == [{"foo": "bar"}, {"baz": "qux"}]' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "true" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
#--------------------------------------------------------------------
|
||||||
|
# tolerations
|
||||||
|
|
||||||
@test "server/standalone-StatefulSet: tolerations not set by default" {
|
@test "server/standalone-StatefulSet: tolerations not set by default" {
|
||||||
cd `chart_dir`
|
cd `chart_dir`
|
||||||
|
|
|
@ -380,6 +380,13 @@
|
||||||
"string"
|
"string"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"topologySpreadConstraints": {
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"array",
|
||||||
|
"string"
|
||||||
|
]
|
||||||
|
},
|
||||||
"webhook": {
|
"webhook": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
|
12
values.yaml
12
values.yaml
|
@ -218,6 +218,12 @@ injector:
|
||||||
component: webhook
|
component: webhook
|
||||||
topologyKey: kubernetes.io/hostname
|
topologyKey: kubernetes.io/hostname
|
||||||
|
|
||||||
|
# Topology settings for injector pods
|
||||||
|
# ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
|
||||||
|
# This should be either a multi-line string or YAML matching the topologySpreadConstraints array
|
||||||
|
# in a PodSpec.
|
||||||
|
topologySpreadConstraints: []
|
||||||
|
|
||||||
# Toleration Settings for injector pods
|
# Toleration Settings for injector pods
|
||||||
# This should be either a multi-line string or YAML matching the Toleration array
|
# This should be either a multi-line string or YAML matching the Toleration array
|
||||||
# in a PodSpec.
|
# in a PodSpec.
|
||||||
|
@ -508,6 +514,12 @@ server:
|
||||||
component: server
|
component: server
|
||||||
topologyKey: kubernetes.io/hostname
|
topologyKey: kubernetes.io/hostname
|
||||||
|
|
||||||
|
# Topology settings for server pods
|
||||||
|
# ref: https://kubernetes.io/docs/concepts/workloads/pods/pod-topology-spread-constraints/
|
||||||
|
# This should be either a multi-line string or YAML matching the topologySpreadConstraints array
|
||||||
|
# in a PodSpec.
|
||||||
|
topologySpreadConstraints: []
|
||||||
|
|
||||||
# Toleration Settings for server pods
|
# Toleration Settings for server pods
|
||||||
# This should be either a multi-line string or YAML matching the Toleration array
|
# This should be either a multi-line string or YAML matching the Toleration array
|
||||||
# in a PodSpec.
|
# in a PodSpec.
|
||||||
|
|
Loading…
Reference in a new issue