223 lines
9.1 KiB
YAML
223 lines
9.1 KiB
YAML
{{- $args := dict "ctx" $ "component" "store-gateway" "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.store_gateway.podManagementPolicy }}
|
|
replicas: {{ $rolloutZone.replicas }}
|
|
{{- if and (semverCompare ">= 1.23-0" (include "mimir.kubeVersion" .)) (.Values.store_gateway.persistentVolume.enableRetentionPolicy) }}
|
|
persistentVolumeClaimRetentionPolicy:
|
|
whenDeleted: {{ .Values.store_gateway.persistentVolume.whenDeleted }}
|
|
whenScaled: {{ .Values.store_gateway.persistentVolume.whenScaled }}
|
|
{{- end }}
|
|
selector:
|
|
matchLabels:
|
|
{{- include "mimir.selectorLabels" $args | nindent 6 }}
|
|
updateStrategy:
|
|
{{- if $zoneName }}
|
|
type: OnDelete
|
|
{{- else }}
|
|
{{- toYaml .Values.store_gateway.strategy | nindent 4 }}
|
|
{{- end }}
|
|
serviceName: {{ template "mimir.fullname" . }}-store-gateway{{- if not .Values.enterprise.legacyLabels -}}-headless{{- end -}}
|
|
{{- if .Values.store_gateway.persistentVolume.enabled }}
|
|
volumeClaimTemplates:
|
|
- apiVersion: v1
|
|
kind: PersistentVolumeClaim
|
|
metadata:
|
|
name: storage
|
|
{{- if .Values.store_gateway.persistentVolume.annotations }}
|
|
annotations:
|
|
{{- toYaml .Values.store_gateway.persistentVolume.annotations | nindent 10 }}
|
|
{{- end }}
|
|
spec:
|
|
{{- $storageClass := default .Values.store_gateway.persistentVolume.storageClass $rolloutZone.storageClass }}
|
|
{{- if $storageClass }}
|
|
{{- if (eq "-" $storageClass) }}
|
|
storageClassName: ""
|
|
{{- else }}
|
|
storageClassName: {{ $storageClass }}
|
|
{{- end }}
|
|
{{- end }}
|
|
accessModes:
|
|
{{- toYaml .Values.store_gateway.persistentVolume.accessModes | nindent 10 }}
|
|
resources:
|
|
requests:
|
|
storage: "{{ .Values.store_gateway.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.store_gateway.schedulerName }}
|
|
schedulerName: {{ . | quote }}
|
|
{{- end }}
|
|
serviceAccountName: {{ template "mimir.serviceAccountName" . }}
|
|
{{- if .Values.store_gateway.priorityClassName }}
|
|
priorityClassName: {{ .Values.store_gateway.priorityClassName }}
|
|
{{- end }}
|
|
securityContext:
|
|
{{- include "mimir.lib.podSecurityContext" $args | nindent 8 }}
|
|
{{- with .Values.store_gateway.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" "store-gateway") | nindent 6 }}
|
|
{{- with .Values.store_gateway.tolerations }}
|
|
tolerations:
|
|
{{- toYaml . | nindent 8 }}
|
|
{{- end }}
|
|
terminationGracePeriodSeconds: {{ .Values.store_gateway.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.store_gateway.persistentVolume.enabled }}
|
|
- name: storage
|
|
emptyDir: {}
|
|
{{- end }}
|
|
{{- if .Values.store_gateway.extraVolumes }}
|
|
{{ toYaml .Values.store_gateway.extraVolumes | nindent 8 }}
|
|
{{- end }}
|
|
{{- if .Values.global.extraVolumes }}
|
|
{{ toYaml .Values.global.extraVolumes | nindent 8 }}
|
|
{{- end }}
|
|
- name: active-queries
|
|
emptyDir: {}
|
|
containers:
|
|
{{- if .Values.store_gateway.extraContainers }}
|
|
{{ toYaml .Values.store_gateway.extraContainers | nindent 8 }}
|
|
{{- end }}
|
|
- name: store-gateway
|
|
image: "{{ include "mimir.imageReference" . }}"
|
|
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
|
args:
|
|
- "-target=store-gateway"
|
|
- "-config.expand-env=true"
|
|
- "-config.file=/etc/mimir/mimir.yaml"
|
|
{{- if $zoneName }}
|
|
- "-store-gateway.sharding-ring.instance-availability-zone={{ $zoneName }}"
|
|
{{- else }}
|
|
{{- if .Values.store_gateway.zoneAwareReplication.migration.enabled }}
|
|
- "-store-gateway.sharding-ring.prefix=collectors/"
|
|
- "-store-gateway.sharding-ring.zone-awareness-enabled=false"
|
|
{{- end }}
|
|
{{- end }}
|
|
{{- range $key, $value := .Values.store_gateway.extraArgs }}
|
|
- "-{{ $key }}={{ $value }}"
|
|
{{- end }}
|
|
volumeMounts:
|
|
{{- if .Values.store_gateway.extraVolumeMounts }}
|
|
{{ toYaml .Values.store_gateway.extraVolumeMounts | nindent 12}}
|
|
{{- end }}
|
|
{{- if .Values.global.extraVolumeMounts }}
|
|
{{ toYaml .Values.global.extraVolumeMounts | nindent 12}}
|
|
{{- end }}
|
|
- name: config
|
|
mountPath: /etc/mimir
|
|
{{- if .Values.enterprise.enabled }}
|
|
- name: license
|
|
mountPath: /license
|
|
{{- end }}
|
|
- name: runtime-config
|
|
mountPath: /var/{{ include "mimir.name" . }}
|
|
- name: storage
|
|
mountPath: "/data"
|
|
{{- if .Values.store_gateway.persistentVolume.subPath }}
|
|
subPath: {{ .Values.store_gateway.persistentVolume.subPath }}
|
|
{{- 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.store_gateway.livenessProbe | nindent 12 }}
|
|
readinessProbe:
|
|
{{- toYaml .Values.store_gateway.readinessProbe | nindent 12 }}
|
|
resources:
|
|
{{- toYaml .Values.store_gateway.resources | nindent 12 }}
|
|
securityContext:
|
|
{{- toYaml .Values.store_gateway.containerSecurityContext | nindent 12 }}
|
|
{{- $cpu_request := dig "requests" "cpu" nil .Values.store_gateway.resources }}
|
|
{{- $mem_request := dig "requests" "memory" nil .Values.store_gateway.resources }}
|
|
{{- $jaeger_queue_size := dig "jaegerReporterMaxQueueSize" nil .Values.store_gateway }}
|
|
{{- if or .Values.global.extraEnv .Values.store_gateway.env $cpu_request $mem_request $jaeger_queue_size }}
|
|
env:
|
|
{{- with .Values.global.extraEnv }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.store_gateway.env }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- if $cpu_request }}
|
|
{{- $cpu_request_doubled := include "mimir.parseCPU" (dict "value" $cpu_request) | float64 | mulf 2 | ceil }}
|
|
{{- $cpu_request_plus_four := include "mimir.parseCPU" (dict "value" $cpu_request) | float64 | addf 4 | ceil }}
|
|
- name: "GOMAXPROCS"
|
|
value: {{ max $cpu_request_doubled $cpu_request_plus_four | toString | toYaml }}
|
|
{{- end }}
|
|
{{- if $mem_request }}
|
|
- name: "GOMEMLIMIT"
|
|
value: {{include "mimir.siToBytes" (dict "value" $mem_request) | toString | toYaml }}
|
|
{{- 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.store_gateway.extraEnvFrom }}
|
|
envFrom:
|
|
{{- with .Values.global.extraEnvFrom }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- with .Values.store_gateway.extraEnvFrom }}
|
|
{{- toYaml . | nindent 12 }}
|
|
{{- end }}
|
|
{{- end }}
|
|
|
|
---
|
|
{{ end }}
|
|
{{ end }}
|