blob: 80699f21fd16258ad1a7586df5c270c86dd6e096 [file] [log] [blame]
Mohammed Naser65cda132024-05-02 14:34:08 -04001{{- $isDistributed := eq (include "loki.deployment.isDistributed" .) "true" -}}
2{{- if $isDistributed }}
3apiVersion: apps/v1
4kind: Deployment
5metadata:
6 name: {{ include "loki.querierFullname" . }}
7 namespace: {{ .Release.Namespace }}
8 labels:
9 {{- include "loki.querierLabels" . | nindent 4 }}
10 app.kubernetes.io/part-of: memberlist
11 {{- with .Values.loki.annotations }}
12 annotations:
13 {{- toYaml . | nindent 4 }}
14 {{- end }}
15spec:
16{{- if not .Values.querier.autoscaling.enabled }}
17 replicas: {{ .Values.querier.replicas }}
18{{- end }}
19 strategy:
20 rollingUpdate:
21 maxSurge: {{ .Values.querier.maxSurge }}
22 maxUnavailable: 1
23 revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
24 selector:
25 matchLabels:
26 {{- include "loki.querierSelectorLabels" . | nindent 6 }}
27 template:
28 metadata:
29 annotations:
30 {{- include "loki.config.checksum" . | nindent 8 }}
31 {{- with .Values.loki.podAnnotations }}
32 {{- toYaml . | nindent 8 }}
33 {{- end }}
34 {{- with .Values.querier.podAnnotations }}
35 {{- toYaml . | nindent 8 }}
36 {{- end }}
37 labels:
38 {{- include "loki.querierSelectorLabels" . | nindent 8 }}
39 app.kubernetes.io/part-of: memberlist
40 {{- with .Values.loki.podLabels }}
41 {{- toYaml . | nindent 8 }}
42 {{- end }}
43 {{- with .Values.querier.podLabels }}
44 {{- toYaml . | nindent 8 }}
45 {{- end }}
46 spec:
47 {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
48 {{- with .Values.querier.topologySpreadConstraints }}
49 topologySpreadConstraints:
50 {{- toYaml . | nindent 8 }}
51 {{- end }}
52 {{- end }}
53 serviceAccountName: {{ include "loki.serviceAccountName" . }}
54 {{- with .Values.imagePullSecrets }}
55 imagePullSecrets:
56 {{- toYaml . | nindent 8 }}
57 {{- end }}
58 {{- with .Values.querier.hostAliases }}
59 hostAliases:
60 {{- toYaml . | nindent 8 }}
61 {{- end }}
62 {{- include "loki.querierPriorityClassName" . | nindent 6 }}
63 securityContext:
64 {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
65 terminationGracePeriodSeconds: {{ .Values.querier.terminationGracePeriodSeconds }}
66 {{- with .Values.querier.initContainers }}
67 initContainers:
68 {{- toYaml . | nindent 8 }}
69 {{- end }}
70 containers:
71 - name: querier
72 image: {{ include "loki.image" . }}
73 imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
74 args:
75 - -config.file=/etc/loki/config/config.yaml
76 - -target=querier
77 {{- if .Values.ingester.zoneAwareReplication.enabled }}
78 {{- if and (.Values.ingester.zoneAwareReplication.migration.enabled) (not .Values.ingester.zoneAwareReplication.migration.readPath) }}
79 - -distributor.zone-awareness-enabled=false
80 {{- else }}
81 - -distributor.zone-awareness-enabled=true
82 {{- end }}
83 {{- end }}
84 {{- with .Values.querier.extraArgs }}
85 {{- toYaml . | nindent 12 }}
86 {{- end }}
87 ports:
88 - name: http-metrics
89 containerPort: 3100
90 protocol: TCP
91 - name: grpc
92 containerPort: 9095
93 protocol: TCP
94 - name: http-memberlist
95 containerPort: 7946
96 protocol: TCP
97 {{- with .Values.querier.extraEnv }}
98 env:
99 {{- toYaml . | nindent 12 }}
100 {{- end }}
101 {{- with .Values.querier.extraEnvFrom }}
102 envFrom:
103 {{- toYaml . | nindent 12 }}
104 {{- end }}
105 securityContext:
106 {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
107 readinessProbe:
108 {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
109 livenessProbe:
110 {{- toYaml .Values.loki.livenessProbe | nindent 12 }}
111 volumeMounts:
112 - name: config
113 mountPath: /etc/loki/config
114 - name: runtime-config
115 mountPath: /etc/loki/runtime-config
116 - name: data
117 mountPath: /var/loki
118 {{- if .Values.enterprise.enabled }}
119 - name: license
120 mountPath: /etc/loki/license
121 {{- end }}
122 {{- with .Values.querier.extraVolumeMounts }}
123 {{- toYaml . | nindent 12 }}
124 {{- end }}
125 resources:
126 {{- toYaml .Values.querier.resources | nindent 12 }}
127 {{- if .Values.querier.extraContainers }}
128 {{- toYaml .Values.querier.extraContainers | nindent 8}}
129 {{- end }}
130 {{- with .Values.querier.affinity }}
131 affinity:
132 {{- toYaml . | nindent 8 }}
133 {{- end }}
134 {{- with .Values.querier.nodeSelector }}
135 nodeSelector:
136 {{- toYaml . | nindent 8 }}
137 {{- end }}
138 {{- with .Values.querier.tolerations }}
139 tolerations:
140 {{- toYaml . | nindent 8 }}
141 {{- end }}
142 {{- with .Values.querier.dnsConfig }}
143 dnsConfig:
144 {{- toYaml . | nindent 8 }}
145 {{- end }}
146 volumes:
147 - name: config
148 {{- include "loki.configVolume" . | nindent 10 }}
149 - name: runtime-config
150 configMap:
151 name: {{ template "loki.name" . }}-runtime
152 {{- if .Values.enterprise.enabled }}
153 - name: license
154 secret:
155 {{- if .Values.enterprise.useExternalLicense }}
156 secretName: {{ .Values.enterprise.externalLicenseName }}
157 {{- else }}
158 secretName: enterprise-logs-license
159 {{- end }}
160 {{- end }}
161 - name: data
162 emptyDir: {}
163 {{- with .Values.querier.extraVolumes }}
164 {{- toYaml . | nindent 8 }}
165 {{- end }}
166{{- end }}