Skip to content

Commit

Permalink
Add server.hostNetwork option (hashicorp#775)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomhjp authored Sep 12, 2022
1 parent c15d83e commit 7e21a09
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 1 deletion.
4 changes: 4 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ spec:
shareProcessNamespace: true
{{ end }}
{{- template "server.statefulSet.securityContext.pod" . }}
{{- if not .Values.global.openshift }}
hostNetwork: {{ .Values.server.hostNetwork }}
{{- end }}

volumes:
{{ template "vault.volumes" . }}
- name: home
Expand Down
24 changes: 23 additions & 1 deletion test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1783,4 +1783,26 @@ load _helpers
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].securityContext.foo' | tee /dev/stderr)
[ "${actual}" = "bar" ]
}
}

#--------------------------------------------------------------------
# hostNetwork

@test "server/StatefulSet: server.hostNetwork not set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostNetwork' | tee /dev/stderr)
[ "${actual}" = "false" ]
}

@test "server/StatefulSet: server.hostNetwork is set" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.hostNetwork=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.hostNetwork' | tee /dev/stderr)
[ "${actual}" = "true" ]
}
3 changes: 3 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -979,6 +979,9 @@
"null",
"array"
]
},
"hostNetwork": {
"type": "boolean"
}
}
},
Expand Down
2 changes: 2 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -876,6 +876,8 @@ server:
pod: {}
container: {}

# Should the server pods run on the host network
hostNetwork: false

# Vault UI
ui:
Expand Down

0 comments on commit 7e21a09

Please sign in to comment.