Skip to content

Commit

Permalink
Add extraPorts property (#841)
Browse files Browse the repository at this point in the history
  • Loading branch information
mitashkistz authored Feb 16, 2023
1 parent 34d8650 commit e31e70e
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 0 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## Unreleased

Features:
* server: New `extraPorts` option for adding ports to the Vault server statefulset [GH-841](https://github.com/hashicorp/vault-helm/pull/841)

## 0.23.0 (November 28th, 2022)

Changes:
Expand Down
3 changes: 3 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ spec:
name: https-internal
- containerPort: 8202
name: {{ include "vault.scheme" . }}-rep
{{- if .Values.server.extraPorts -}}
{{ toYaml .Values.server.extraPorts | nindent 12}}
{{- end }}
{{- if .Values.server.readinessProbe.enabled }}
readinessProbe:
{{- if .Values.server.readinessProbe.path }}
Expand Down
23 changes: 23 additions & 0 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1806,3 +1806,26 @@ load _helpers
yq -r '.spec.template.spec.hostNetwork' | tee /dev/stderr)
[ "${actual}" = "true" ]
}

#--------------------------------------------------------------------
# extraPorts

@test "server/standalone-StatefulSet: adds extra ports" {
cd `chart_dir`

# Test that it defines it
local object=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.extraPorts[0].containerPort=1111' \
--set 'server.extraPorts[0].name=foo' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.containers[0].ports[] | select(.name == "foo")' | tee /dev/stderr)

local actual=$(echo $object |
yq -r '.containerPort' | tee /dev/stderr)
[ "${actual}" = "1111" ]

local actual=$(echo $object |
yq -r '.name' | tee /dev/stderr)
[ "${actual}" = "foo" ]
}
6 changes: 6 additions & 0 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,12 @@
"extraArgs": {
"type": "string"
},
"extraPorts": {
"type": [
"null",
"array"
]
},
"extraContainers": {
"type": [
"null",
Expand Down
6 changes: 6 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -456,6 +456,12 @@ server:
# extraArgs is a string containing additional Vault server arguments.
extraArgs: ""

# extraPorts is a list of extra ports. Specified as a YAML list.
# This is useful if you need to add additional ports to the statefulset in dynamic way.
extraPorts: null
# - containerPort: 8300
# name: http-monitoring

# Used to define custom readinessProbe settings
readinessProbe:
enabled: true
Expand Down

0 comments on commit e31e70e

Please sign in to comment.