Allow configure StatefulSet updateStrategy (#172)

This commit is contained in:
Yong Wen Chua 2020-01-18 20:36:45 +08:00 committed by Jason O'Donnell
parent 0099ea8a94
commit eccd71bfe2
3 changed files with 24 additions and 9 deletions

View file

@ -15,7 +15,7 @@ spec:
podManagementPolicy: Parallel podManagementPolicy: Parallel
replicas: {{ template "vault.replicas" . }} replicas: {{ template "vault.replicas" . }}
updateStrategy: updateStrategy:
type: OnDelete type: {{ .Values.server.updateStrategyType }}
selector: selector:
matchLabels: matchLabels:
app.kubernetes.io/name: {{ template "vault.name" . }} app.kubernetes.io/name: {{ template "vault.name" . }}
@ -122,7 +122,7 @@ spec:
{{- end }} {{- end }}
lifecycle: lifecycle:
# Vault container doesn't receive SIGTERM from Kubernetes # 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 # causes issues with graceful shutdowns such as deregistering itself
# from Consul (zombie services). # from Consul (zombie services).
preStop: preStop:

View file

@ -97,6 +97,17 @@ load _helpers
[ "${actual}" = "OnDelete" ] [ "${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 # affinity

View file

@ -21,8 +21,8 @@ injector:
tag: "0.1.2" tag: "0.1.2"
pullPolicy: IfNotPresent pullPolicy: IfNotPresent
# agentImage sets the repo and tag of the Vault image to use for the Vault Agent # 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 # containers. This should be set to the official Vault image. Vault 1.3.1+ is
# required. # required.
agentImage: agentImage:
repository: "vault" repository: "vault"
@ -76,6 +76,10 @@ server:
# Overrides the default Image Pull Policy # Overrides the default Image Pull Policy
pullPolicy: IfNotPresent 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:
# resources: # resources:
# requests: # requests:
@ -85,7 +89,7 @@ server:
# memory: 256Mi # memory: 256Mi
# cpu: 250m # 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. # from Kubernetes to access Vault pods.
ingress: ingress:
enabled: false enabled: false
@ -109,7 +113,7 @@ server:
# method. https://www.vaultproject.io/docs/auth/kubernetes.html # method. https://www.vaultproject.io/docs/auth/kubernetes.html
authDelegator: authDelegator:
enabled: true enabled: true
# extraContainers is a list of sidecar containers. Specified as a raw YAML string. # extraContainers is a list of sidecar containers. Specified as a raw YAML string.
extraContainers: null extraContainers: null
@ -198,12 +202,12 @@ server:
# used to communicate with pods directly through DNS instead of a round robin # used to communicate with pods directly through DNS instead of a round robin
# load balancer. # load balancer.
# clusterIP: None # 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. # or NodePort.
#type: ClusterIP #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. # will be random if left blank.
#nodePort: 30000 #nodePort: 30000