Skip to content

Commit

Permalink
Allow configure StatefulSet updateStrategy (#172)
Browse files Browse the repository at this point in the history
  • Loading branch information
lawliet89 authored and jasonodonnell committed Jan 18, 2020
1 parent 0099ea8 commit eccd71b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
4 changes: 2 additions & 2 deletions templates/server-statefulset.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ spec:
podManagementPolicy: Parallel
replicas: {{ template "vault.replicas" . }}
updateStrategy:
type: OnDelete
type: {{ .Values.server.updateStrategyType }}
selector:
matchLabels:
app.kubernetes.io/name: {{ template "vault.name" . }}
Expand Down Expand Up @@ -122,7 +122,7 @@ spec:
{{- end }}
lifecycle:
# Vault container doesn't receive SIGTERM from Kubernetes
# and after the grace period ends, Kube sends SIGKILL. This
# and after the grace period ends, Kube sends SIGKILL. This
# causes issues with graceful shutdowns such as deregistering itself
# from Consul (zombie services).
preStop:
Expand Down
11 changes: 11 additions & 0 deletions test/unit/server-ha-statefulset.bats
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,17 @@ load _helpers
[ "${actual}" = "OnDelete" ]
}

@test "server/ha-StatefulSet: RollingUpdate updateStrategy" {
cd `chart_dir`
local actual=$(helm template \
-x templates/server-statefulset.yaml \
--set 'server.ha.enabled=true' \
--set 'server.updateStrategyType="RollingUpdate"' \
. | tee /dev/stderr |
yq -r '.spec.updateStrategy.type' | tee /dev/stderr)
[ "${actual}" = "RollingUpdate" ]
}

#--------------------------------------------------------------------
# affinity

Expand Down
18 changes: 11 additions & 7 deletions values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ injector:
tag: "0.1.2"
pullPolicy: IfNotPresent

# agentImage sets the repo and tag of the Vault image to use for the Vault Agent
# containers. This should be set to the official Vault image. Vault 1.3.1+ is
# agentImage sets the repo and tag of the Vault image to use for the Vault Agent
# containers. This should be set to the official Vault image. Vault 1.3.1+ is
# required.
agentImage:
repository: "vault"
Expand Down Expand Up @@ -76,6 +76,10 @@ server:
# Overrides the default Image Pull Policy
pullPolicy: IfNotPresent

# Configure the Update Strategy Type for the StatefulSet
# See https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/#update-strategies
updateStrategyType: "OnDelete"

resources:
# resources:
# requests:
Expand All @@ -85,7 +89,7 @@ server:
# memory: 256Mi
# cpu: 250m

# Ingress allows ingress services to be created to allow external access
# Ingress allows ingress services to be created to allow external access
# from Kubernetes to access Vault pods.
ingress:
enabled: false
Expand All @@ -109,7 +113,7 @@ server:
# method. https://www.vaultproject.io/docs/auth/kubernetes.html
authDelegator:
enabled: true

# extraContainers is a list of sidecar containers. Specified as a raw YAML string.
extraContainers: null

Expand Down Expand Up @@ -198,12 +202,12 @@ server:
# used to communicate with pods directly through DNS instead of a round robin
# load balancer.
# clusterIP: None
# Configures the service type for the main Vault service. Can be ClusterIP

# 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,
# If type is set to "NodePort", a specific nodePort value can be configured,
# will be random if left blank.
#nodePort: 30000

Expand Down

0 comments on commit eccd71b

Please sign in to comment.