2018-09-28 20:56:48 +00:00
|
|
|
# StatefulSet to run the actual vault server cluster.
|
2018-09-03 16:05:59 +00:00
|
|
|
{{- if (or (and (ne (.Values.server.enabled | toString) "-") .Values.server.enabled) (and (eq (.Values.server.enabled | toString) "-") .Values.global.enabled)) }}
|
2018-08-18 05:08:03 +00:00
|
|
|
apiVersion: apps/v1
|
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
2018-09-28 20:56:48 +00:00
|
|
|
name: {{ template "vault.fullname" . }}-server
|
2018-08-18 21:38:33 +00:00
|
|
|
labels:
|
2018-09-28 20:56:48 +00:00
|
|
|
app: {{ template "vault.name" . }}
|
|
|
|
chart: {{ template "vault.chart" . }}
|
2018-08-18 21:38:33 +00:00
|
|
|
heritage: {{ .Release.Service }}
|
|
|
|
release: {{ .Release.Name }}
|
2018-08-18 05:08:03 +00:00
|
|
|
spec:
|
2018-09-28 20:56:48 +00:00
|
|
|
serviceName: {{ template "vault.fullname" . }}-server
|
2018-08-18 05:08:03 +00:00
|
|
|
podManagementPolicy: Parallel
|
|
|
|
replicas: {{ .Values.server.replicas }}
|
2018-08-18 21:38:33 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
2018-09-28 20:56:48 +00:00
|
|
|
app: {{ template "vault.name" . }}
|
|
|
|
chart: {{ template "vault.chart" . }}
|
2018-08-18 21:38:33 +00:00
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: server
|
2018-08-18 05:08:03 +00:00
|
|
|
template:
|
|
|
|
metadata:
|
|
|
|
labels:
|
2018-09-28 20:56:48 +00:00
|
|
|
app: {{ template "vault.name" . }}
|
|
|
|
chart: {{ template "vault.chart" . }}
|
2018-08-18 21:38:33 +00:00
|
|
|
release: {{ .Release.Name }}
|
|
|
|
component: server
|
2018-08-18 05:08:03 +00:00
|
|
|
spec:
|
|
|
|
affinity:
|
|
|
|
podAntiAffinity:
|
|
|
|
requiredDuringSchedulingIgnoredDuringExecution:
|
|
|
|
- labelSelector:
|
2018-08-18 21:38:33 +00:00
|
|
|
matchLabels:
|
2018-09-28 20:56:48 +00:00
|
|
|
app: {{ template "vault.name" . }}
|
2018-08-18 21:38:33 +00:00
|
|
|
release: "{{ .Release.Name }}"
|
|
|
|
component: server
|
2018-08-18 05:08:03 +00:00
|
|
|
topologyKey: kubernetes.io/hostname
|
|
|
|
terminationGracePeriodSeconds: 10
|
|
|
|
securityContext:
|
|
|
|
fsGroup: 1000
|
|
|
|
volumes:
|
|
|
|
- name: config
|
|
|
|
configMap:
|
2018-09-28 20:56:48 +00:00
|
|
|
name: {{ template "vault.fullname" . }}-server-config
|
2018-09-08 15:28:13 +00:00
|
|
|
{{- range .Values.server.extraVolumes }}
|
|
|
|
- name: userconfig-{{ .name }}
|
|
|
|
{{ .type }}:
|
|
|
|
{{- if (eq .type "configMap") }}
|
|
|
|
name: {{ .name }}
|
|
|
|
{{- else if (eq .type "secret") }}
|
|
|
|
secretName: {{ .name }}
|
|
|
|
{{- end }}
|
|
|
|
{{- end }}
|
2018-08-18 05:08:03 +00:00
|
|
|
containers:
|
2018-09-28 20:56:48 +00:00
|
|
|
- name: vault
|
2018-10-02 21:14:57 +00:00
|
|
|
securityContext:
|
|
|
|
fsGroup: 1000
|
2018-10-05 21:12:32 +00:00
|
|
|
# TODO: confirm Vault needs this
|
2018-10-02 21:14:57 +00:00
|
|
|
privileged: true
|
2018-09-05 14:45:54 +00:00
|
|
|
image: "{{ default .Values.global.image .Values.server.image }}"
|
2018-08-18 05:08:03 +00:00
|
|
|
env:
|
|
|
|
- name: POD_IP
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: status.podIP
|
|
|
|
- name: NAMESPACE
|
|
|
|
valueFrom:
|
|
|
|
fieldRef:
|
|
|
|
fieldPath: metadata.namespace
|
2018-10-02 21:14:57 +00:00
|
|
|
- name: VAULT_ADDR
|
|
|
|
value: "http://localhost:8200"
|
2018-08-18 05:08:03 +00:00
|
|
|
command:
|
2018-10-02 21:14:57 +00:00
|
|
|
- "vault"
|
|
|
|
- "server"
|
|
|
|
- "-config=/vault/config/"
|
2018-08-18 05:08:03 +00:00
|
|
|
volumeMounts:
|
|
|
|
- name: data
|
2018-09-28 20:56:48 +00:00
|
|
|
mountPath: /vault/data
|
2018-08-18 05:08:03 +00:00
|
|
|
- name: config
|
2018-09-28 20:56:48 +00:00
|
|
|
mountPath: /vault/config
|
2018-09-08 15:28:13 +00:00
|
|
|
{{- range .Values.server.extraVolumes }}
|
|
|
|
- name: userconfig-{{ .name }}
|
|
|
|
readOnly: true
|
2018-09-28 20:56:48 +00:00
|
|
|
mountPath: /vault/userconfig/{{ .name }}
|
2018-09-08 15:28:13 +00:00
|
|
|
{{- end }}
|
2018-08-18 05:08:03 +00:00
|
|
|
lifecycle:
|
|
|
|
preStop:
|
|
|
|
exec:
|
|
|
|
command:
|
2018-10-02 21:14:57 +00:00
|
|
|
- vault step-down
|
2018-08-18 05:08:03 +00:00
|
|
|
ports:
|
2018-10-02 21:14:57 +00:00
|
|
|
- containerPort: 8200
|
2018-08-18 05:08:03 +00:00
|
|
|
name: http
|
2018-10-02 21:14:57 +00:00
|
|
|
#readinessProbe:
|
|
|
|
# # NOTE(mitchellh): when our HTTP status endpoints support the
|
|
|
|
# # proper status codes, we should switch to that. This is temporary.
|
|
|
|
# # TODO: verify for Vault
|
|
|
|
# #exec:
|
|
|
|
# # command:
|
|
|
|
# # - "/bin/sh"
|
|
|
|
# # - "-ec"
|
|
|
|
# # - |
|
|
|
|
# # curl http://127.0.0.1:8500/v1/status/leader 2>/dev/null | \
|
|
|
|
# # grep -E '".+"'
|
|
|
|
# failureThreshold: 2
|
|
|
|
# initialDelaySeconds: 5
|
|
|
|
# periodSeconds: 3
|
|
|
|
# successThreshold: 1
|
|
|
|
# timeoutSeconds: 5
|
2018-08-18 05:08:03 +00:00
|
|
|
volumeClaimTemplates:
|
|
|
|
- metadata:
|
|
|
|
name: data
|
|
|
|
spec:
|
|
|
|
accessModes:
|
|
|
|
- ReadWriteOnce
|
|
|
|
resources:
|
|
|
|
requests:
|
|
|
|
storage: {{ .Values.server.storage }}
|
2018-09-20 19:35:08 +00:00
|
|
|
{{- if .Values.server.storageClass }}
|
|
|
|
storageClassName: {{ .Values.server.storageClass }}
|
|
|
|
{{- end }}
|
2018-08-18 05:08:03 +00:00
|
|
|
{{- end }}
|