Add configurable nodeport (#152)
This commit is contained in:
parent
36d6c283e4
commit
268c2418d3
3 changed files with 68 additions and 1 deletions
|
@ -32,6 +32,9 @@ spec:
|
||||||
- name: http
|
- name: http
|
||||||
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") }}
|
||||||
|
nodePort: {{ .Values.server.service.nodePort }}
|
||||||
|
{{- end }}
|
||||||
- name: internal
|
- name: internal
|
||||||
port: 8201
|
port: 8201
|
||||||
targetPort: 8201
|
targetPort: 8201
|
||||||
|
|
|
@ -303,3 +303,59 @@ load _helpers
|
||||||
yq -r '.spec.ports[0].targetPort' | tee /dev/stderr)
|
yq -r '.spec.ports[0].targetPort' | tee /dev/stderr)
|
||||||
[ "${actual}" = "80" ]
|
[ "${actual}" = "80" ]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@test "server/Service: nodeport can set" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
--set 'server.service.nodePort=30008' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "30008" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
--set 'server.service.nodePort=30009' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "30009" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.service.type=NodePort' \
|
||||||
|
--set 'server.service.nodePort=30010' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "30010" ]
|
||||||
|
}
|
||||||
|
|
||||||
|
@test "server/Service: nodeport can't set when type isn't NodePort" {
|
||||||
|
cd `chart_dir`
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.dev.enabled=true' \
|
||||||
|
--set 'server.service.nodePort=30008' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.ha.enabled=true' \
|
||||||
|
--set 'server.service.nodePort=30009' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
|
||||||
|
local actual=$(helm template \
|
||||||
|
-x templates/server-service.yaml \
|
||||||
|
--set 'server.standalone.enabled=true' \
|
||||||
|
--set 'server.service.nodePort=30010' \
|
||||||
|
. | tee /dev/stderr |
|
||||||
|
yq -r '.spec.ports[0].nodePort' | tee /dev/stderr)
|
||||||
|
[ "${actual}" = "null" ]
|
||||||
|
}
|
||||||
|
|
|
@ -139,6 +139,14 @@ server:
|
||||||
# load balancer.
|
# load balancer.
|
||||||
# clusterIP: None
|
# clusterIP: None
|
||||||
|
|
||||||
|
# Configures the service type for the main Vault service. Can be ClusterIP
|
||||||
|
# or NodePort.
|
||||||
|
#type: ClusterIP
|
||||||
|
|
||||||
|
# If type is set to "NodePort", a specific nodePort value can be configured,
|
||||||
|
# will be random if left blank.
|
||||||
|
#nodePort: 30000
|
||||||
|
|
||||||
# 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
|
||||||
|
|
Loading…
Reference in a new issue