diff --git a/templates/server-service.yaml b/templates/server-service.yaml index 3032579..34fd89f 100644 --- a/templates/server-service.yaml +++ b/templates/server-service.yaml @@ -24,8 +24,8 @@ spec: publishNotReadyAddresses: true ports: - name: http - port: 8200 - targetPort: 8200 + port: {{ .Values.server.service.port }} + targetPort: {{ .Values.server.service.targetPort }} - name: internal port: 8201 targetPort: 8201 diff --git a/test/unit/server-service.bats b/test/unit/server-service.bats index 71f2bc5..2e23d30 100755 --- a/test/unit/server-service.bats +++ b/test/unit/server-service.bats @@ -212,3 +212,35 @@ load _helpers yq -r '.spec.clusterIP' | tee /dev/stderr) [ "${actual}" = "None" ] } + +@test "server/Service: port and targetPort will be 8200 by default" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-service.yaml \ + . | tee /dev/stderr | + yq -r '.spec.ports[0].port' | tee /dev/stderr) + [ "${actual}" = "8200" ] + + local actual=$(helm template \ + -x templates/server-service.yaml \ + . | tee /dev/stderr | + yq -r '.spec.ports[0].targetPort' | tee /dev/stderr) + [ "${actual}" = "8200" ] +} + +@test "server/Service: port and targetPort can be set" { + cd `chart_dir` + local actual=$(helm template \ + -x templates/server-service.yaml \ + --set 'server.service.port=8000' \ + . | tee /dev/stderr | + yq -r '.spec.ports[0].port' | tee /dev/stderr) + [ "${actual}" = "8000" ] + + local actual=$(helm template \ + -x templates/server-service.yaml \ + --set 'server.service.targetPort=80' \ + . | tee /dev/stderr | + yq -r '.spec.ports[0].targetPort' | tee /dev/stderr) + [ "${actual}" = "80" ] +} \ No newline at end of file diff --git a/values.yaml b/values.yaml index 5c07299..42393bf 100644 --- a/values.yaml +++ b/values.yaml @@ -93,6 +93,11 @@ server: # load balancer. # clusterIP: None + # Port on which Vault server is listening + port: 8200 + # Target port to which the service should be mapped to + targetPort: 8200 + # This configures the Vault Statefulset to create a PVC for data # storage when using the file backend. # See https://www.vaultproject.io/docs/audit/index.html to know more