Commit 9598c469 authored by Lars Fenneberg's avatar Lars Fenneberg

Helm charts: Add option for using a StatefulSet with persistent storage

parent 3d7908ac
......@@ -45,14 +45,4 @@ We truncate at 63 chars because some Kubernetes name fields are limited to this
{{- end -}}
{{- end -}}
{{/*
Return the appropriate apiVersion for deployment.
*/}}
{{- define "deployment.apiVersion" -}}
{{- if semverCompare ">=1.9-0" .Capabilities.KubeVersion.GitVersion -}}
{{- print "apps/v1" -}}
{{- else -}}
{{- print "extensions/v1beta1" -}}
{{- end -}}
{{- end -}}
apiVersion: {{ template "deployment.apiVersion" . }}
kind: Deployment
apiVersion: apps/v1
kind: {{ .Values.vikingService.kind }}
metadata:
labels:
app.kubernetes.io/name: {{ template "viking-service.name" . }}
......@@ -14,17 +14,33 @@ metadata:
{{ toYaml .Values.vikingService.annotations | nindent 4}}
{{- end }}
spec:
{{/* Try to collect kind specific differences here */}}
{{- if eq .Values.vikingService.kind "Deployment" }}
minReadySeconds: {{ .Values.vikingService.minReadySeconds }}
{{- else }}
serviceName: {{ template "viking-service.fullname" . }}
{{- if .Values.vikingService.persistentVolume.enabled }}
volumeClaimTemplates:
- metadata:
name: persistent-storage
spec:
accessModes: [ "ReadWriteOnce" ]
storageClassName: {{ .Values.vikingService.persistentVolume.storageClass | quote }}
resources:
requests:
storage: {{ .Values.vikingService.persistentVolume.size }}
{{- end }}
{{- end }}
selector:
matchLabels:
app.kubernetes.io/name: {{ template "viking-service.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- if .Values.vikingService.updateStrategy }}
strategy:
{{- toYaml .Values.vikingService.updateStrategy | nindent 4 }}
{{- end }}
replicas: {{ .Values.vikingService.replicaCount }}
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
{{- if .Values.vikingService.updateStrategy }}
strategy:
{{ toYaml .Values.vikingService.updateStrategy | nindent 4 }}
{{- end }}
minReadySeconds: {{ .Values.vikingService.minReadySeconds }}
template:
metadata:
{{- if .Values.vikingService.podAnnotations }}
......@@ -105,6 +121,10 @@ spec:
mountPath: "/run/varnish-home"
- name: run-offload
mountPath: "/run/offload"
{{- if (and (eq .Values.vikingService.kind "StatefulSet") .Values.vikingService.persistentVolume.enabled) }}
- name: persistent-storage
mountPath: "/run/varnish-home/persistent-storage"
{{- end }}
securityContext:
readOnlyRootFilesystem: true
resources:
......
......@@ -21,6 +21,19 @@ vikingService:
resources: {}
# Choose from Deployment or StatefulSet
kind: Deployment
# Only applicable if kind is StatefulSet
persistentVolume:
enabled: false
storageClass: null
size: 1Gi
# Only applicable if kind is Deployment
# minReadySeconds to avoid killing pods before we are ready
minReadySeconds: 0
secrets:
admin: "21d0ac6c-83d5-11ea-8acc-1ff3820da75e"
dataplaneapi: "e24bb312-cb21-46d6-aaec-8ae676f06fea"
......@@ -62,10 +75,6 @@ vikingService:
# maxUnavailable: 1
# type: RollingUpdate
# minReadySeconds to avoid killing pods before we are ready
##
minReadySeconds: 0
## Node tolerations for server scheduling to nodes with taints
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
##
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment