{{- if .Values.vmstorage.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: {{- if .Values.vmstorage.annotations }} annotations: {{ toYaml .Values.vmstorage.annotations | indent 4 }} {{- end }} labels: {{- include "victoria-metrics.vmstorage.labels" . | nindent 4 }} name: {{ template "victoria-metrics.vmstorage.fullname" . }} spec: serviceName: {{ template "victoria-metrics.vmstorage.fullname" . }} selector: matchLabels: {{- include "victoria-metrics.vmstorage.matchLabels" . | nindent 6 }} replicas: {{ .Values.vmstorage.replicaCount }} podManagementPolicy: {{ .Values.vmstorage.podManagementPolicy }} template: metadata: {{- if .Values.vmstorage.podAnnotations }} annotations: {{ toYaml .Values.vmstorage.podAnnotations | indent 8 }} {{- end }} labels: {{- include "victoria-metrics.vmstorage.labels" . | nindent 8 }} spec: {{- if .Values.vmstorage.affinity }} affinity: {{ toYaml .Values.vmstorage.affinity | indent 8 }} {{- end }} {{- if .Values.vmstorage.priorityClassName }} priorityClassName: "{{ .Values.vmstorage.priorityClassName }}" {{- end }} {{- if .Values.vmstorage.schedulerName }} schedulerName: "{{ .Values.vmstorage.schedulerName }}" {{- end }} containers: - name: {{ template "victoria-metrics.name" . }}-{{ .Values.vmstorage.name }} image: "{{ .Values.vmstorage.image.repository }}:{{ .Values.vmstorage.image.tag }}" imagePullPolicy: "{{ .Values.vmstorage.image.pullPolicy }}" args: - {{ printf "%s=%d" "--retentionPeriod" (int .Values.vmstorage.retentionPeriod) | quote}} - {{ printf "%s=%s" "--storageDataPath" .Values.vmstorage.persistentVolume.mountPath | quote}} {{- range $key, $value := .Values.vmstorage.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} ports: - name: http containerPort: 8482 - name: vminsert containerPort: 8400 - name: vmselect containerPort: 8401 readinessProbe: httpGet: path: /health port: http initialDelaySeconds: 5 periodSeconds: 15 timeoutSeconds: 5 livenessProbe: tcpSocket: port: http initialDelaySeconds: 5 periodSeconds: 15 timeoutSeconds: 5 resources: {{ toYaml .Values.vmstorage.resources | indent 12 }} volumeMounts: - name: vmstorage-volume mountPath: {{ .Values.vmstorage.persistentVolume.mountPath }} subPath: {{ .Values.vmstorage.persistentVolume.subPath }} {{- range .Values.vmstorage.extraHostPathMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- range .Values.vmstorage.extraConfigmapMounts }} - name: {{ $.Values.vmstorage.name }}-{{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- range .Values.vmstorage.extraSecretMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 2 }} {{- end }} {{- if .Values.vmstorage.nodeSelector }} nodeSelector: {{ toYaml .Values.vmstorage.nodeSelector | indent 8 }} {{- end }} {{- if .Values.vmstorage.securityContext }} securityContext: {{ toYaml .Values.vmstorage.securityContext | indent 8 }} {{- end }} {{- if .Values.vmstorage.tolerations }} tolerations: {{ toYaml .Values.vmstorage.tolerations | indent 8 }} {{- end }} {{- if .Values.vmstorage.affinity }} affinity: {{ toYaml .Values.vmstorage.affinity | indent 8 }} {{- end }} terminationGracePeriodSeconds: {{ .Values.vmstorage.terminationGracePeriodSeconds }} volumes: {{- range .Values.vmstorage.extraHostPathMounts }} - name: {{ .name }} hostPath: path: {{ .hostPath }} {{- end }} {{- range .Values.vmstorage.extraConfigmapMounts }} - name: {{ $.Values.vmstorage.name }}-{{ .name }} configMap: name: {{ .configMap }} {{- end }} {{- range .Values.vmstorage.extraConfigmapMounts }} - name: {{ $.Values.vmstorage.name }}-{{ .name }} configMap: name: {{ .configMap }} {{- end }} {{- range .Values.vmstorage.extraSecretMounts }} - name: {{ .name }} secret: secretName: {{ .secretName }} {{- end }} {{- range .Values.vmstorage.extraConfigmapMounts }} - name: {{ .name }} configMap: name: {{ .configMap }} {{- end }} {{- if .Values.vmstorage.persistentVolume.enabled }} volumeClaimTemplates: - metadata: name: vmstorage-volume {{- if .Values.vmstorage.persistentVolume.annotations }} annotations: {{ toYaml .Values.vmstorage.persistentVolume.annotations | indent 10 }} {{- end }} spec: accessModes: {{ toYaml .Values.vmstorage.persistentVolume.accessModes | indent 10 }} resources: requests: storage: "{{ .Values.vmstorage.persistentVolume.size }}" {{- if .Values.vmstorage.persistentVolume.storageClass }} {{- if (eq "-" .Values.vmstorage.persistentVolume.storageClass) }} storageClassName: "" {{- else }} storageClassName: "{{ .Values.vmstorage.persistentVolume.storageClass }}" {{- end }} {{- end }} {{- else }} volumes: - name: vmstorage-volume emptyDir: {} {{- end }} {{- end }}