Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make terminationGracePeriodSeconds configurable #659

Merged
merged 6 commits into from
Dec 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

Features:
* Added configurable podDisruptionBudget for injector [GH-653](https://github.com/hashicorp/vault-helm/pull/653)
* Make terminationGracePeriodSeconds configurable for server [GH-659](https://github.com/hashicorp/vault-helm/pull/659)

## 0.18.0 (November 17th, 2021)

Expand Down
2 changes: 1 addition & 1 deletion templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ spec:
{{- if .Values.server.priorityClassName }}
priorityClassName: {{ .Values.server.priorityClassName }}
{{- end }}
terminationGracePeriodSeconds: 10
terminationGracePeriodSeconds: {{ .Values.server.terminationGracePeriodSeconds }}
serviceAccountName: {{ template "vault.serviceAccount.name" . }}
{{ if .Values.server.shareProcessNamespace }}
shareProcessNamespace: true
Expand Down
21 changes: 21 additions & 0 deletions test/unit/server-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,27 @@ load _helpers
[[ "${actual}" = *"foobar"* ]]
}

#--------------------------------------------------------------------
# terminationGracePeriodSeconds
@test "server/standalone-StatefulSet: terminationGracePeriodSeconds default" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
. | tee /dev/stderr |
yq -r '.spec.template.spec.terminationGracePeriodSeconds' | tee /dev/stderr)
[[ "${actual}" = "10" ]]
}

@test "server/standalone-StatefulSet: terminationGracePeriodSeconds 30" {
cd `chart_dir`
local actual=$(helm template \
--show-only templates/server-statefulset.yaml \
--set 'server.terminationGracePeriodSeconds=30' \
. | tee /dev/stderr |
yq -r '.spec.template.spec.terminationGracePeriodSeconds' | tee /dev/stderr)
[[ "${actual}" = "30" ]]
}

#--------------------------------------------------------------------
# preStop
@test "server/standalone-StatefulSet: preStop sleep duration default" {
Expand Down
24 changes: 18 additions & 6 deletions values.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@
"string"
]
},
"kubeletRootDir": {
"type": "string"
},
"providersDir": {
"type": "string"
},
Comment on lines +17 to +22
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating all these missing parameters!

"updateStrategy": {
"type": "object",
"properties": {
Expand All @@ -24,12 +30,6 @@
"type": "string"
}
}
},
"providersDir": {
"type": "string"
},
"kubeletRootDir": {
"type": "string"
}
}
},
Expand Down Expand Up @@ -603,6 +603,9 @@
"labels": {
"type": "object"
},
"pathType": {
"type": "string"
},
"tls": {
"type": "array"
}
Expand Down Expand Up @@ -728,6 +731,9 @@
"enabled": {
"type": "boolean"
},
"externalTrafficPolicy": {
"type": "string"
},
"port": {
"type": "integer"
},
Expand Down Expand Up @@ -781,6 +787,9 @@
}
}
},
"terminationGracePeriodSeconds": {
"type": "integer"
},
"tolerations": {
"type": [
"null",
Expand Down Expand Up @@ -823,6 +832,9 @@
"externalPort": {
"type": "integer"
},
"externalTrafficPolicy": {
"type": "string"
},
"publishNotReadyAddresses": {
"type": "boolean"
},
Expand Down
4 changes: 4 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ server:
# Number of seconds after which the probe times out.
timeoutSeconds: 3

# Optional duration in seconds the pod needs to terminate gracefully.
# See: https://kubernetes.io/docs/concepts/containers/container-lifecycle-hooks/
terminationGracePeriodSeconds: 10

# Used to set the sleep time during the preStop step
preStopSleepSeconds: 5

Expand Down