{{- $args := dict "ctx" . "component" "ingester" "memberlist" true -}} {{- $zonesMap := include "mimir.zoneAwareReplicationMap" $args | fromYaml -}} {{- range $zoneName, $rolloutZone := $zonesMap }} {{- with $ -}} {{- $_ := set $args "rolloutZoneName" $zoneName -}} apiVersion: apps/v1 kind: StatefulSet metadata: name: {{ include "mimir.resourceName" $args }} labels: {{- include "mimir.labels" $args | nindent 4 }} annotations: {{- include "mimir.componentAnnotations" $args | nindent 4 }} namespace: {{ .Release.Namespace | quote }} spec: podManagementPolicy: {{ .Values.ingester.podManagementPolicy }} replicas: {{ $rolloutZone.replicas }} {{- if and (semverCompare ">= 1.23-0" (include "mimir.kubeVersion" .)) (.Values.ingester.persistentVolume.enableRetentionPolicy) }} persistentVolumeClaimRetentionPolicy: whenDeleted: {{ .Values.ingester.persistentVolume.whenDeleted }} whenScaled: {{ .Values.ingester.persistentVolume.whenScaled }} {{- end }} selector: matchLabels: {{- include "mimir.selectorLabels" $args | nindent 6 }} updateStrategy: {{- if $zoneName }} type: OnDelete {{- else }} {{- toYaml .Values.ingester.statefulStrategy | nindent 4 }} {{- end }} serviceName: {{ template "mimir.fullname" . }}-ingester{{- if not .Values.enterprise.legacyLabels -}}-headless{{- end -}} {{- if .Values.ingester.persistentVolume.enabled }} volumeClaimTemplates: - apiVersion: v1 kind: PersistentVolumeClaim metadata: name: storage {{- if .Values.ingester.persistentVolume.annotations }} annotations: {{- toYaml .Values.ingester.persistentVolume.annotations | nindent 10 }} {{- end }} spec: {{- $storageClass := default .Values.ingester.persistentVolume.storageClass $rolloutZone.storageClass }} {{- if $storageClass }} {{- if (eq "-" $storageClass) }} storageClassName: "" {{- else }} storageClassName: {{ $storageClass }} {{- end }} {{- end }} accessModes: {{- toYaml .Values.ingester.persistentVolume.accessModes | nindent 10 }} resources: requests: storage: "{{ .Values.ingester.persistentVolume.size }}" {{- end }} template: metadata: labels: {{- include "mimir.podLabels" $args | nindent 8 }} annotations: {{- include "mimir.podAnnotations" $args | nindent 8 }} namespace: {{ .Release.Namespace | quote }} spec: {{- with .Values.ingester.schedulerName }} schedulerName: {{ . | quote }} {{- end }} serviceAccountName: {{ template "mimir.serviceAccountName" . }} {{- if .Values.ingester.priorityClassName }} priorityClassName: {{ .Values.ingester.priorityClassName }} {{- end }} securityContext: {{- include "mimir.lib.podSecurityContext" $args | nindent 8 }} {{- with .Values.ingester.initContainers }} initContainers: {{- toYaml . | nindent 8 }} {{- end }} {{- if .Values.image.pullSecrets }} imagePullSecrets: {{- range .Values.image.pullSecrets }} - name: {{ . }} {{- end }} {{- end }} {{- with $rolloutZone.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with $rolloutZone.affinity }} affinity: {{- toYaml . | nindent 8 }} {{- end }} {{- include "mimir.lib.topologySpreadConstraints" (dict "ctx" . "component" "ingester") | nindent 6 }} {{- with .Values.ingester.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }} volumes: - name: config {{- include "mimir.configVolume" . | nindent 10 }} {{- if .Values.enterprise.enabled }} - name: license secret: secretName: {{ tpl .Values.license.secretName . }} {{- end }} - name: runtime-config configMap: name: {{ template "mimir.fullname" . }}-runtime {{- if not .Values.ingester.persistentVolume.enabled }} - name: storage emptyDir: {} {{- end }} {{- if .Values.ingester.extraVolumes }} {{ toYaml .Values.ingester.extraVolumes | nindent 8 }} {{- end }} {{- if .Values.global.extraVolumes }} {{ toYaml .Values.global.extraVolumes | nindent 8 }} {{- end }} - name: active-queries emptyDir: {} containers: {{- if .Values.ingester.extraContainers }} {{ toYaml .Values.ingester.extraContainers | nindent 8 }} {{- end }} - name: ingester image: "{{ include "mimir.imageReference" . }}" imagePullPolicy: {{ .Values.image.pullPolicy }} args: - "-target=ingester" - "-config.expand-env=true" - "-config.file=/etc/mimir/mimir.yaml" {{- if $zoneName }} - "-ingester.ring.instance-availability-zone={{ $zoneName }}" {{- else }} - "-ingester.ring.instance-availability-zone=zone-default" {{- if .Values.ingester.zoneAwareReplication.migration.enabled }} - "-blocks-storage.tsdb.flush-blocks-on-shutdown=true" - "-ingester.ring.unregister-on-shutdown=true" {{- end }} - "-server.grpc-max-concurrent-streams=500" {{- end }} {{- range $key, $value := .Values.ingester.extraArgs }} - "-{{ $key }}={{ $value }}" {{- end }} volumeMounts: {{- if .Values.ingester.extraVolumeMounts }} {{ toYaml .Values.ingester.extraVolumeMounts | nindent 12}} {{- end }} {{- if .Values.global.extraVolumeMounts }} {{ toYaml .Values.global.extraVolumeMounts | nindent 12}} {{- end }} - name: config mountPath: /etc/mimir - name: runtime-config mountPath: /var/{{ include "mimir.name" . }} - name: storage mountPath: "/data" {{- if .Values.ingester.persistentVolume.subPath }} subPath: {{ .Values.ingester.persistentVolume.subPath }} {{- end }} {{- if .Values.enterprise.enabled }} - name: license mountPath: /license {{- end }} - name: active-queries mountPath: /active-query-tracker ports: - name: http-metrics containerPort: {{ include "mimir.serverHttpListenPort" . }} protocol: TCP - name: grpc containerPort: {{ include "mimir.serverGrpcListenPort" . }} protocol: TCP - name: memberlist containerPort: {{ include "mimir.memberlistBindPort" . }} protocol: TCP livenessProbe: {{- toYaml .Values.ingester.livenessProbe | nindent 12 }} readinessProbe: {{- toYaml .Values.ingester.readinessProbe | nindent 12 }} resources: {{- toYaml .Values.ingester.resources | nindent 12 }} securityContext: {{- toYaml .Values.ingester.containerSecurityContext | nindent 12 }} {{- $jaeger_queue_size := dig "jaegerReporterMaxQueueSize" nil .Values.ingester }} {{- if or .Values.global.extraEnv .Values.ingester.env $jaeger_queue_size }} env: {{- with .Values.global.extraEnv }} {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.ingester.env }} {{- toYaml . | nindent 12 }} {{- end }} {{- if $jaeger_queue_size }} - name: "JAEGER_REPORTER_MAX_QUEUE_SIZE" value: {{$jaeger_queue_size | toString | toYaml }} {{- end }} {{- end }} {{- if or .Values.global.extraEnvFrom .Values.ingester.extraEnvFrom }} envFrom: {{- with .Values.global.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.ingester.extraEnvFrom }} {{- toYaml . | nindent 12 }} {{- end }} {{- end }} --- {{ end }} {{ end }}