diff --git a/templates/server-statefulset.yaml b/templates/server-statefulset.yaml index 519d421c3..f330927d6 100644 --- a/templates/server-statefulset.yaml +++ b/templates/server-statefulset.yaml @@ -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}} diff --git a/test/unit/server-statefulset.bats b/test/unit/server-statefulset.bats index 7dc01f584..de3ee2bdd 100755 --- a/test/unit/server-statefulset.bats +++ b/test/unit/server-statefulset.bats @@ -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 diff --git a/values.schema.json b/values.schema.json index 39f0e0274..d1c87e0c4 100644 --- a/values.schema.json +++ b/values.schema.json @@ -740,6 +740,9 @@ } } }, + "hostAliases": { + "type": "array" + }, "image": { "type": "object", "properties": { diff --git a/values.yaml b/values.yaml index c100c17ea..78b41afff 100644 --- a/values.yaml +++ b/values.yaml @@ -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: