Skip to content

Commit

Permalink
make shareProcessNamespace configurable (#174)
Browse files Browse the repository at this point in the history
* make shareProcessNamespace configurable

* add unit tests
  • Loading branch information
fischerman authored and jasonodonnell committed Jan 15, 2020
1 parent 1f68852 commit 4209cbc
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Unreleased

Improvements:

* Allow process namespace sharing between Vault and sidecar containers

## 0.3.3 (January 14th, 2020)

Security:
Expand Down
3 changes: 3 additions & 0 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ spec:
{{ template "vault.nodeselector" . }}
terminationGracePeriodSeconds: 10
serviceAccountName: {{ template "vault.fullname" . }}
{{ if .Values.server.shareProcessNamespace }}
shareProcessNamespace: true
{{ end }}
securityContext:
runAsNonRoot: true
runAsGroup: {{ .Values.server.gid | default 1000 }}
Expand Down
27 changes: 27 additions & 0 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -670,6 +670,33 @@ load _helpers
[ "${containers_count}" = 1 ]
}

# sharedProcessNamespace

@test "server/standalone-StatefulSet: shareProcessNamespace disabled by default" {
cd `chart_dir`

# Test that it defines it
local actual=$(helm template \
-x templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.shareProcessNamespace' | tee /dev/stderr)

[ "${actual}" = "null" ]
}

@test "server/standalone-StatefulSet: shareProcessNamespace enabled" {
cd `chart_dir`

# Test that it defines it
local actual=$(helm template \
-x templates/server-statefulset.yaml \
--set 'server.shareProcessNamespace=true' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.shareProcessNamespace' | tee /dev/stderr)

[ "${actual}" = "true" ]
}

# extra labels

@test "server/standalone-StatefulSet: specify extraLabels" {
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,10 @@ server:
# extraContainers is a list of sidecar containers. Specified as a raw YAML string.
extraContainers: null

# shareProcessNamespace enables process namespace sharing between Vault and the extraContainers
# This is useful if Vault must be signaled, e.g. to send a SIGHUP for log rotation
shareProcessNamespace: false

# extraArgs is a string containing additional Vault server arguments.
extraArgs: ""

Expand Down

0 comments on commit 4209cbc

Please sign in to comment.