feat: add hostAliases for statefulset (#955)

This commit is contained in:
Milan Rafaj 2023-09-18 17:53:00 +02:00 committed by GitHub
parent c3b2b14ffd
commit 3387881451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 34 additions and 1 deletions

View file

@ -61,6 +61,10 @@ spec:
{{ template "vault.volumes" . }}
- name: home
emptyDir: {}
{{- if .Values.server.hostAliases }}
hostAliases:
{{ toYaml .Values.server.hostAliases | nindent 8}}
{{- end }}
{{- if .Values.server.extraInitContainers }}
initContainers:
{{ toYaml .Values.server.extraInitContainers | nindent 8}}

View file

@ -1826,6 +1826,28 @@ load _helpers
[ "${actual}" = "true" ]
}
#--------------------------------------------------------------------
# hostAliases
@test "server/StatefulSet: server.hostAliases not set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostAliases' | tee /dev/stderr)
[ "${actual}" = "null" ]
}
@test "server/StatefulSet: server.hostAliases is set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.hostAliases[0]=foo' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostAliases[]' | tee /dev/stderr)
[ "${actual}" = "foo" ]
}
#--------------------------------------------------------------------
# extraPorts

View file

@ -740,6 +740,9 @@
}
}
},
"hostAliases": {
"type": "array"
},
"image": {
"type": "object",
"properties": {

View file

@ -444,7 +444,11 @@ server:
# - secretName: chart-example-tls
# hosts:
# - chart-example.local
# hostAliases is a list of aliases to be added to /etc/hosts. Specified as a YAML list.
hostAliases: []
# - ip: 127.0.0.1
# hostnames:
# - chart-example.local
# OpenShift only - create a route to expose the service
# By default the created route will be of type passthrough
route: