2021-02-05 20:17:06 +00:00
|
|
|
{{/*
|
2021-02-23 17:21:54 +00:00
|
|
|
This template serves as the blueprint for the StatefulSet objects that are created
|
2021-02-05 20:17:06 +00:00
|
|
|
within the common library.
|
|
|
|
*/}}
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- define "common.statefulset" }}
|
2021-10-19 19:42:28 +00:00
|
|
|
{{- $values := .Values }}
|
2021-08-31 18:49:20 +00:00
|
|
|
{{- $releaseName := .Release.Name }}
|
2021-05-19 18:51:35 +00:00
|
|
|
---
|
|
|
|
apiVersion: apps/v1
|
2021-02-05 20:17:06 +00:00
|
|
|
kind: StatefulSet
|
|
|
|
metadata:
|
|
|
|
name: {{ include "common.names.fullname" . }}
|
|
|
|
labels:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- include "common.labels" . | nindent 4 }}
|
|
|
|
{{- with .Values.controller.labels }}
|
|
|
|
{{- toYaml . | nindent 4 }}
|
|
|
|
{{- end }}
|
2021-05-27 23:22:40 +00:00
|
|
|
{{- with .Values.controller.annotations }}
|
2021-06-10 21:52:55 +00:00
|
|
|
annotations:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- toYaml . | nindent 4 }}
|
2021-02-05 20:17:06 +00:00
|
|
|
{{- end }}
|
|
|
|
spec:
|
2021-05-19 18:51:35 +00:00
|
|
|
revisionHistoryLimit: {{ .Values.controller.revisionHistoryLimit }}
|
|
|
|
replicas: {{ .Values.controller.replicas }}
|
|
|
|
{{- $strategy := default "RollingUpdate" .Values.controller.strategy }}
|
|
|
|
{{- if and (ne $strategy "OnDelete") (ne $strategy "RollingUpdate") }}
|
|
|
|
{{- fail (printf "Not a valid strategy type for StatefulSet (%s)" $strategy) }}
|
2021-02-05 20:17:06 +00:00
|
|
|
{{- end }}
|
2021-05-19 18:51:35 +00:00
|
|
|
updateStrategy:
|
|
|
|
type: {{ $strategy }}
|
|
|
|
{{- if and (eq $strategy "RollingUpdate") .Values.controller.rollingUpdate.partition }}
|
|
|
|
rollingUpdate:
|
|
|
|
partition: {{ .Values.controller.rollingUpdate.partition }}
|
|
|
|
{{- end }}
|
2021-02-05 20:17:06 +00:00
|
|
|
selector:
|
|
|
|
matchLabels:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- include "common.labels.selectorLabels" . | nindent 6 }}
|
2021-02-05 20:17:06 +00:00
|
|
|
serviceName: {{ include "common.names.fullname" . }}
|
|
|
|
template:
|
|
|
|
metadata:
|
2021-05-27 23:22:40 +00:00
|
|
|
{{- with .Values.podAnnotations }}
|
2021-06-10 21:52:55 +00:00
|
|
|
annotations:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- toYaml . | nindent 8 }}
|
2021-02-05 20:17:06 +00:00
|
|
|
{{- end }}
|
|
|
|
labels:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- include "common.labels.selectorLabels" . | nindent 8 }}
|
2021-06-10 21:52:55 +00:00
|
|
|
{{- with .Values.podLabels }}
|
|
|
|
{{- toYaml . | nindent 8 }}
|
|
|
|
{{- end }}
|
2021-02-05 20:17:06 +00:00
|
|
|
spec:
|
|
|
|
{{- include "common.controller.pod" . | nindent 6 }}
|
|
|
|
volumeClaimTemplates:
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- range $index, $vct := .Values.volumeClaimTemplates }}
|
2021-07-06 11:53:15 +00:00
|
|
|
{{- $vctname := $index }}
|
|
|
|
{{- if $vct.name }}
|
|
|
|
{{- $vctname := $vct.name }}
|
|
|
|
{{- end }}
|
2021-05-19 18:51:35 +00:00
|
|
|
- metadata:
|
2021-07-06 11:53:15 +00:00
|
|
|
name: {{ $vctname }}
|
2021-05-19 18:51:35 +00:00
|
|
|
spec:
|
|
|
|
accessModes:
|
2021-11-15 18:30:09 +00:00
|
|
|
- {{ ( $vct.accessMode | default "ReadWriteOnce" ) | quote }}
|
2021-05-19 18:51:35 +00:00
|
|
|
resources:
|
|
|
|
requests:
|
2021-11-15 18:30:09 +00:00
|
|
|
storage: {{ $vct.size | default "999Gi" | quote }}
|
2021-11-22 16:12:06 +00:00
|
|
|
{{ include "common.storage.class" ( dict "persistence" $vct "global" $) }}
|
2021-05-19 18:51:35 +00:00
|
|
|
{{- end }}
|
2021-02-05 20:17:06 +00:00
|
|
|
{{- end }}
|