123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273 |
- {{- $app := .Values.vmstorage }}
- {{- if $app.enabled -}}
- {{- $ctx := dict "helm" . "appKey" "vmstorage" }}
- {{- $fullname := include "vm.plain.fullname" $ctx }}
- {{- $sa := include "vm.fullname" $ctx }}
- {{- $ns := include "vm.namespace" $ctx }}
- apiVersion: apps/v1
- kind: StatefulSet
- metadata:
- {{- with $app.annotations }}
- annotations: {{ toYaml . | nindent 4 }}
- {{- end }}
- {{- $_ := set $ctx "extraLabels" $app.extraLabels }}
- labels: {{ include "vm.labels" $ctx | nindent 4 }}
- {{- $_ := unset $ctx "extraLabels" }}
- name: {{ $fullname }}
- namespace: {{ $ns }}
- spec:
- serviceName: {{ $fullname }}
- selector:
- matchLabels: {{ include "vm.selectorLabels" $ctx | nindent 6 }}
- replicas: {{ $app.replicaCount }}
- podManagementPolicy: {{ $app.podManagementPolicy }}
- template:
- metadata:
- {{- with $app.podAnnotations }}
- annotations: {{ toYaml . | nindent 8 }}
- {{- end }}
- {{- $_ := set $ctx "extraLabels" $app.podLabels }}
- labels: {{ include "vm.podLabels" $ctx | nindent 8 }}
- spec:
- {{- with $app.priorityClassName }}
- priorityClassName: {{ . }}
- {{- end }}
- {{- with $app.schedulerName }}
- schedulerName: {{ . }}
- {{- end }}
- {{- $manager := $app.vmbackupmanager }}
- {{- if or $app.initContainers $manager.restore.onStart.enabled }}
- initContainers:
- {{- with $app.initContainers -}}
- {{- toYaml . | nindent 8 }}
- {{- end -}}
- {{- if $manager.restore.onStart.enabled }}
- {{- include "vm.enterprise.only" . }}
- - name: vmbackupmanager-restore
- image: {{ include "vm.image" (dict "helm" . "app" $manager) }}
- imagePullPolicy: {{ $app.image.pullPolicy }}
- {{- if $app.securityContext.enabled }}
- securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
- {{- end }}
- args: {{ include "vmbackupmanager.restore.args" . | nindent 12 }}
- {{- with $manager.resources }}
- resources: {{ toYaml . | nindent 12 }}
- {{- end }}
- env:
- - name: POD_NAME
- valueFrom:
- fieldRef:
- fieldPath: metadata.name
- {{- with $manager.env }}
- {{- toYaml . | nindent 12 }}
- {{- end }}
- ports:
- - name: manager-http
- containerPort: 8300
- volumeMounts:
- - name: vmstorage-volume
- mountPath: {{ $app.persistentVolume.mountPath }}
- subPath: {{ $app.persistentVolume.subPath }}
- {{- range $manager.extraSecretMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- subPath: {{ .subPath }}
- {{- end }}
- {{- end }}
- {{- end }}
- {{- with ($app.imagePullSecrets | default .Values.global.imagePullSecrets) }}
- imagePullSecrets: {{ toYaml . | nindent 8 }}
- {{- end }}
- containers:
- - name: vmstorage
- image: {{ include "vm.image" (dict "helm" . "app" $app) }}
- imagePullPolicy: {{ $app.image.pullPolicy }}
- {{- with $app.containerWorkingDir }}
- workingDir: {{ . }}
- {{- end }}
- {{- if $app.securityContext.enabled }}
- securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
- {{- end }}
- args: {{ include "vmstorage.args" . | nindent 12 }}
- ports:
- - name: {{ $app.ports.name | default "http" }}
- containerPort: {{ include "vm.port.from.flag" (dict "flag" $app.extraArgs.httpListenAddr "default" "8482") }}
- - name: vminsert
- containerPort: 8400
- - name: vmselect
- containerPort: 8401
- {{- with $app.envFrom }}
- envFrom: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with $app.env }}
- env: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "readiness"))) }}
- readinessProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "liveness"))) }}
- livenessProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $app "type" "startup"))) }}
- startupProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with $app.resources }}
- resources: {{ toYaml . | nindent 12 }}
- {{- end }}
- volumeMounts:
- {{- with $app.persistentVolume }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- end }}
- {{- range $app.extraHostPathMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- with .readOnly }}
- readOnly: {{ . }}
- {{- end }}
- {{- end }}
- {{- range $app.extraConfigmapMounts }}
- - name: {{ $app.name }}-{{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- with .readOnly }}
- readOnly: {{ . }}
- {{- end }}
- {{- end }}
- {{- range $app.extraSecretMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- with .readOnly }}
- readOnly: {{ . }}
- {{- end }}
- {{- end }}
- {{- with $app.extraVolumeMounts }}
- {{- toYaml . | nindent 12 }}
- {{- end }}
- {{- include "vm.license.mount" . | nindent 12 }}
- {{- if $manager.enabled }}
- {{- include "vm.enterprise.only" . }}
- - name: vmbackupmanager
- image: {{ include "vm.image" (dict "helm" . "app" $manager) }}
- imagePullPolicy: {{ $app.image.pullPolicy }}
- {{- if $app.securityContext.enabled }}
- securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.securityContext "helm" .) | nindent 12 }}
- {{- end }}
- args: {{ include "vmbackupmanager.args" . | nindent 12 }}
- {{- with $manager.resources }}
- resources: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "readiness"))) }}
- readinessProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "liveness"))) }}
- livenessProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- {{- with (fromYaml (include "vm.probe" (dict "app" $manager "type" "startup"))) }}
- startupProbe: {{ toYaml . | nindent 12 }}
- {{- end }}
- env:
- - name: POD_NAME
- valueFrom:
- fieldRef:
- fieldPath: metadata.name
- {{- with $manager.env }}
- {{- toYaml . | nindent 12 }}
- {{- end }}
- ports:
- - name: manager-http
- containerPort: 8300
- volumeMounts:
- {{- with $app.persistentVolume }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- end }}
- {{- range $manager.extraSecretMounts }}
- - name: {{ .name }}
- mountPath: {{ .mountPath }}
- {{- with .subPath }}
- subPath: {{ . }}
- {{- end }}
- {{- with .readOnly }}
- readOnly: {{ . }}
- {{- end }}
- {{- end }}
- {{- include "vm.license.mount" . | nindent 12 }}
- {{- end }}
- {{- with $app.extraContainers }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- with $app.nodeSelector }}
- nodeSelector: {{ toYaml . | nindent 8 }}
- {{- end }}
- {{- if $app.podSecurityContext.enabled }}
- securityContext: {{ include "vm.securityContext" (dict "securityContext" $app.podSecurityContext "helm" .) | nindent 8 }}
- {{- end }}
- {{- if or (.Values.serviceAccount).name (.Values.serviceAccount).create }}
- automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }}
- serviceAccountName: {{ (.Values.serviceAccount).name | default $sa }}
- {{- end }}
- {{- with $app.tolerations }}
- tolerations: {{ toYaml . | nindent 8 }}
- {{- end }}
- {{- with $app.affinity }}
- affinity: {{ toYaml . | nindent 8 }}
- {{- end }}
- {{- with $app.topologySpreadConstraints }}
- topologySpreadConstraints: {{ toYaml . | nindent 8 }}
- {{- end }}
- terminationGracePeriodSeconds: {{ $app.terminationGracePeriodSeconds }}
- {{- if or $app.extraVolumes (not $app.persistentVolume.enabled) $app.persistentVolume.existingClaim (include "vm.license.volume" .) }}
- volumes:
- {{- with $app.extraVolumes }}
- {{- toYaml . | nindent 8 }}
- {{- end }}
- {{- if or (not $app.persistentVolume.enabled) $app.persistentVolume.existingClaim }}
- - name: vmstorage-volume
- {{- if $app.persistentVolume.enabled }}
- persistentVolumeClaim:
- claimName: {{ $app.persistentVolume.existingClaim }}
- {{- else }}
- emptyDir: {{ toYaml $app.emptyDir | nindent 12 }}
- {{- end }}
- {{- end }}
- {{- include "vm.license.volume" . | nindent 8 }}
- {{- end }}
- {{- if and $app.persistentVolume.enabled (not $app.persistentVolume.existingClaim) }}
- volumeClaimTemplates:
- - apiVersion: v1
- kind: PersistentVolumeClaim
- metadata:
- name: {{ $app.persistentVolume.name }}
- {{- with $app.persistentVolume.annotations }}
- annotations: {{ toYaml . | nindent 10 }}
- {{- end }}
- {{- with $app.persistentVolume.labels }}
- labels: {{ toYaml . | nindent 10 }}
- {{- end }}
- spec:
- {{- with $app.persistentVolume.accessModes }}
- accessModes: {{ toYaml . | nindent 10 }}
- {{- end }}
- resources:
- requests:
- storage: {{ $app.persistentVolume.size }}
- {{- with $app.persistentVolume.storageClassName }}
- storageClassName: {{ ternary "" . (eq "-" .) }}
- {{- end }}
- {{- end }}
- {{- end }}
|