{{- if and .Values.vmselect.enabled .Values.vmselect.statefulSet.enabled -}} apiVersion: apps/v1 kind: StatefulSet metadata: {{- with .Values.vmselect.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} labels: {{- include "victoria-metrics.vmselect.labels" . | nindent 4 }} {{- with .Values.vmselect.extraLabels }} {{ toYaml . | indent 4 }} {{- end }} name: {{ template "victoria-metrics.vmselect.fullname" . }} namespace: {{ .Release.Namespace }} spec: serviceName: {{ template "victoria-metrics.vmselect.fullname" . }} selector: matchLabels: {{- include "victoria-metrics.vmselect.matchLabels" . | nindent 6 }} replicas: {{ .Values.vmselect.replicaCount }} podManagementPolicy: {{ .Values.vmselect.podManagementPolicy }} template: metadata: {{- if .Values.vmselect.podAnnotations }} annotations: {{ toYaml .Values.vmselect.podAnnotations | indent 8 }} {{- end }} labels: {{- include "victoria-metrics.vmselect.labels" . | nindent 8 }} {{- with .Values.vmselect.extraLabels }} {{ toYaml . | indent 8 }} {{- end }} spec: {{- if .Values.vmselect.priorityClassName }} priorityClassName: "{{ .Values.vmselect.priorityClassName }}" {{- end }} automountServiceAccountToken: {{ .Values.serviceAccount.automountToken }} {{- with .Values.vmselect.initContainers }} initContainers: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: {{ template "victoria-metrics.name" . }}-{{ .Values.vmselect.name }} image: "{{ .Values.vmselect.image.repository }}:{{ .Values.vmselect.image.tag }}" imagePullPolicy: "{{ .Values.vmselect.image.pullPolicy }}" {{- if .Values.vmselect.containerWorkingDir }} workingDir: {{ .Values.vmselect.containerWorkingDir }} {{- end }} securityContext: {{- toYaml .Values.vmselect.podSecurityContext | nindent 12 }} args: - {{ printf "%s=%s" "--cacheDataPath" .Values.vmselect.cacheMountPath | quote}} {{- if not .Values.vmselect.suppresStorageFQDNsRender }} {{- include "victoria-metrics.vmselect.vmstorage-pod-fqdn" . | nindent 12 }} {{- end }} {{- include "victoria-metrics.vmselect.vmselect-pod-fqdn" . | nindent 12 -}} {{- range $key, $value := .Values.vmselect.extraArgs }} - --{{ $key }}={{ $value }} {{- end }} env: - name: TZ value: Asia/Kolkata {{- with .Values.vmselect.env }} {{ toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: 8481 {{- if .Values.vmselect.extraArgs.clusternativeListenAddr }} - name: cluster-tcp protocol: TCP containerPort: {{ include "split-host-port" .Values.vmselect.extraArgs.clusternativeListenAddr }} {{- end }} readinessProbe: httpGet: {{- if index .Values.vmselect.extraArgs "http.pathPrefix" }} path: {{ trimSuffix "/" (index .Values.vmselect.extraArgs "http.pathPrefix") }}/health {{- else }} path: /health {{- end }} port: http initialDelaySeconds: 5 periodSeconds: 15 livenessProbe: tcpSocket: port: http initialDelaySeconds: 5 periodSeconds: 15 timeoutSeconds: 5 volumeMounts: - mountPath: {{ .Values.vmselect.cacheMountPath }} name: cache-volume {{- range .Values.vmstorage.extraHostPathMounts }} - name: {{ .name }} mountPath: {{ .mountPath }} subPath: {{ .subPath }} readOnly: {{ .readOnly }} {{- end }} {{- with .Values.vmselect.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.vmselect.resources }} resources: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.vmselect.extraContainers }} {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.imagePullSecrets }} imagePullSecrets: {{ toYaml .Values.imagePullSecrets | indent 2 }} {{- end }} {{- if .Values.vmselect.securityContext }} securityContext: {{ toYaml .Values.vmselect.securityContext | indent 8 }} {{- end }} serviceAccountName: {{ template "victoria-metrics.serviceAccountName" . }} {{- if .Values.schedulerName }} schedulerName: "{{ .Values.schedulerName }}" {{- end }} nodeSelector: {{- if .Values.dedicatedValue }} dedicated: {{ include "meesho.vmselect.dedicatedValue" . }} {{- else }} {{- with .Values.vmselect.nodeSelector }} {{ toYaml . | nindent 8 }} {{- end }} {{- end }} tolerations: {{- if .Values.dedicatedValue }} - key: "dedicated" operator: "Equal" value: {{ include "meesho.vmselect.dedicatedValue" . }} effect: "NoSchedule" {{- else }} {{- with .Values.vmselect.tolerations }} {{ toYaml . | nindent 8 }} {{- end }} {{- end }} {{- if .Values.vmselect.affinity }} affinity: {{ toYaml .Values.vmselect.affinity | indent 8 }} {{- end }} volumes: {{- with .Values.vmselect.extraVolumes }} {{- toYaml . | nindent 6 }} {{- end }} {{- if not .Values.vmselect.persistentVolume.enabled }} - name: cache-volume emptyDir: {} {{- end }} {{- if .Values.vmselect.persistentVolume.enabled }} volumeClaimTemplates: - metadata: name: cache-volume {{- if .Values.vmselect.persistentVolume.annotations }} annotations: {{ toYaml .Values.vmselect.persistentVolume.annotations | indent 10 }} {{- end }} {{- if .Values.vmstorage.persistentVolume.labels }} labels: {{ toYaml .Values.vmstorage.persistentVolume.labels | indent 10 }} {{- end }} spec: accessModes: {{- toYaml .Values.vmselect.persistentVolume.accessModes | nindent 10 }} resources: requests: storage: "{{ .Values.vmselect.persistentVolume.size }}" {{- if .Values.vmselect.persistentVolume.storageClass }} {{- if (eq "-" .Values.vmselect.persistentVolume.storageClass) }} storageClassName: "" {{- else }} storageClassName: "{{ .Values.vmselect.persistentVolume.storageClass }}" {{- end }} {{- end }} {{- end }} {{- end }}