Add support for nodePort for active and standby services (#610)

This commit is contained in:
Jack Halford 2022-08-01 22:16:51 +02:00 committed by GitHub
parent 999b0b7ec3
commit 553af862ea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 18 additions and 8 deletions

View file

@ -29,8 +29,8 @@ spec:
- name: {{ include "vault.scheme" . }} - name: {{ include "vault.scheme" . }}
port: {{ .Values.server.service.port }} port: {{ .Values.server.service.port }}
targetPort: {{ .Values.server.service.targetPort }} targetPort: {{ .Values.server.service.targetPort }}
{{- if and (.Values.server.service.nodePort) (eq (.Values.server.service.type | toString) "NodePort") }} {{- if and (.Values.server.service.activeNodePort) (eq (.Values.server.service.type | toString) "NodePort") }}
nodePort: {{ .Values.server.service.nodePort }} nodePort: {{ .Values.server.service.activeNodePort }}
{{- end }} {{- end }}
- name: https-internal - name: https-internal
port: 8201 port: 8201

View file

@ -29,8 +29,8 @@ spec:
- name: {{ include "vault.scheme" . }} - name: {{ include "vault.scheme" . }}
port: {{ .Values.server.service.port }} port: {{ .Values.server.service.port }}
targetPort: {{ .Values.server.service.targetPort }} targetPort: {{ .Values.server.service.targetPort }}
{{- if and (.Values.server.service.nodePort) (eq (.Values.server.service.type | toString) "NodePort") }} {{- if and (.Values.server.service.standbyNodePort) (eq (.Values.server.service.type | toString) "NodePort") }}
nodePort: {{ .Values.server.service.nodePort }} nodePort: {{ .Values.server.service.standbyNodePort }}
{{- end }} {{- end }}
- name: https-internal - name: https-internal
port: 8201 port: 8201

View file

@ -119,7 +119,7 @@ load _helpers
--show-only templates/server-ha-active-service.yaml \ --show-only templates/server-ha-active-service.yaml \
--set 'server.ha.enabled=true' \ --set 'server.ha.enabled=true' \
--set 'server.service.type=NodePort' \ --set 'server.service.type=NodePort' \
--set 'server.service.nodePort=30009' \ --set 'server.service.activeNodePort=30009' \
. | tee /dev/stderr | . | tee /dev/stderr |
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr) yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
[ "${actual}" = "30009" ] [ "${actual}" = "30009" ]
@ -130,7 +130,7 @@ load _helpers
local actual=$(helm template \ local actual=$(helm template \
--show-only templates/server-ha-active-service.yaml \ --show-only templates/server-ha-active-service.yaml \
--set 'server.ha.enabled=true' \ --set 'server.ha.enabled=true' \
--set 'server.service.nodePort=30009' \ --set 'server.service.activeNodePort=30009' \
. | tee /dev/stderr | . | tee /dev/stderr |
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr) yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
[ "${actual}" = "null" ] [ "${actual}" = "null" ]

View file

@ -130,7 +130,7 @@ load _helpers
--show-only templates/server-ha-standby-service.yaml \ --show-only templates/server-ha-standby-service.yaml \
--set 'server.ha.enabled=true' \ --set 'server.ha.enabled=true' \
--set 'server.service.type=NodePort' \ --set 'server.service.type=NodePort' \
--set 'server.service.nodePort=30009' \ --set 'server.service.standbyNodePort=30009' \
. | tee /dev/stderr | . | tee /dev/stderr |
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr) yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
[ "${actual}" = "30009" ] [ "${actual}" = "30009" ]
@ -141,7 +141,7 @@ load _helpers
local actual=$(helm template \ local actual=$(helm template \
--show-only templates/server-ha-standby-service.yaml \ --show-only templates/server-ha-standby-service.yaml \
--set 'server.ha.enabled=true' \ --set 'server.ha.enabled=true' \
--set 'server.service.nodePort=30009' \ --set 'server.service.standbyNodePort=30009' \
. | tee /dev/stderr | . | tee /dev/stderr |
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr) yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
[ "${actual}" = "null" ] [ "${actual}" = "null" ]

View file

@ -601,6 +601,16 @@ server:
# will be random if left blank. # will be random if left blank.
#nodePort: 30000 #nodePort: 30000
# When HA mode is enabled
# If type is set to "NodePort", a specific nodePort value can be configured,
# will be random if left blank.
#activeNodePort: 30001
# When HA mode is enabled
# If type is set to "NodePort", a specific nodePort value can be configured,
# will be random if left blank.
#standbyNodePort: 30002
# Port on which Vault server is listening # Port on which Vault server is listening
port: 8200 port: 8200
# Target port to which the service should be mapped to # Target port to which the service should be mapped to