blob: 245119cb44dca0c81fe1b98a119dd68bd77b0cf4 [file] [log] [blame]
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00001{{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}}
2{{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }}
3---
4apiVersion: apps/v1
5kind: Deployment
6metadata:
7 name: {{ include "loki.readFullname" . }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -03008 namespace: {{ $.Release.Namespace }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +00009 labels:
10 app.kubernetes.io/part-of: memberlist
11 {{- include "loki.readLabels" . | nindent 4 }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -030012 {{- if or (not (empty .Values.loki.annotations)) (not (empty .Values.backend.annotations))}}
13 annotations:
14 {{- with .Values.loki.annotations }}
15 {{- toYaml . | nindent 4 }}
16 {{- end }}
17 {{- with .Values.read.annotations }}
18 {{- toYaml . | nindent 4 }}
19 {{- end }}
20 {{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000021spec:
22 {{- if not .Values.read.autoscaling.enabled }}
23 replicas: {{ .Values.read.replicas }}
24 {{- end }}
25 strategy:
26 rollingUpdate:
27 maxSurge: 0
28 maxUnavailable: 1
29 revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
30 selector:
31 matchLabels:
32 {{- include "loki.readSelectorLabels" . | nindent 6 }}
33 template:
34 metadata:
35 annotations:
Giovanni Tirloni59219b62024-04-09 14:50:25 -030036 checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000037 {{- with .Values.loki.podAnnotations }}
38 {{- toYaml . | nindent 8 }}
39 {{- end }}
40 {{- with .Values.read.podAnnotations }}
41 {{- toYaml . | nindent 8 }}
42 {{- end }}
43 labels:
44 app.kubernetes.io/part-of: memberlist
45 {{- include "loki.readSelectorLabels" . | nindent 8 }}
46 {{- with .Values.loki.podLabels }}
47 {{- toYaml . | nindent 8 }}
48 {{- end }}
49 {{- with .Values.read.podLabels }}
50 {{- toYaml . | nindent 8 }}
51 {{- end }}
52 {{- with .Values.read.selectorLabels }}
53 {{- tpl (toYaml .) $ | nindent 8 }}
54 {{- end }}
55 spec:
56 serviceAccountName: {{ include "loki.serviceAccountName" . }}
57 automountServiceAccountToken: {{ .Values.serviceAccount.automountServiceAccountToken }}
58 {{- with .Values.imagePullSecrets }}
59 imagePullSecrets:
60 {{- toYaml . | nindent 8 }}
61 {{- end }}
62 {{- include "loki.readPriorityClassName" . | nindent 6 }}
63 securityContext:
64 {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
65 terminationGracePeriodSeconds: {{ .Values.read.terminationGracePeriodSeconds }}
66 containers:
67 - name: loki
68 image: {{ include "loki.image" . }}
69 imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
70 args:
71 - -config.file=/etc/loki/config/config.yaml
72 - -target={{ .Values.read.targetModule }}
73 - -legacy-read-mode=false
Giovanni Tirloni59219b62024-04-09 14:50:25 -030074 - -common.compactor-grpc-address={{ include "loki.backendFullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:{{ .Values.loki.server.grpc_listen_port }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000075 {{- with .Values.read.extraArgs }}
76 {{- toYaml . | nindent 12 }}
77 {{- end }}
78 ports:
79 - name: http-metrics
Giovanni Tirloni59219b62024-04-09 14:50:25 -030080 containerPort: {{ .Values.loki.server.http_listen_port }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000081 protocol: TCP
82 - name: grpc
Giovanni Tirloni59219b62024-04-09 14:50:25 -030083 containerPort: {{ .Values.loki.server.grpc_listen_port }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +000084 protocol: TCP
85 - name: http-memberlist
86 containerPort: 7946
87 protocol: TCP
88 {{- with .Values.read.extraEnv }}
89 env:
90 {{- toYaml . | nindent 12 }}
91 {{- end }}
92 {{- with .Values.read.extraEnvFrom }}
93 envFrom:
94 {{- toYaml . | nindent 12 }}
95 {{- end }}
96 securityContext:
97 {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
98 readinessProbe:
99 {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
100 volumeMounts:
101 - name: config
102 mountPath: /etc/loki/config
103 - name: runtime-config
104 mountPath: /etc/loki/runtime-config
105 - name: tmp
106 mountPath: /tmp
107 - name: data
108 mountPath: /var/loki
109 {{- if .Values.enterprise.enabled }}
110 - name: license
111 mountPath: /etc/loki/license
112 {{- end}}
113 {{- with .Values.read.extraVolumeMounts }}
114 {{- toYaml . | nindent 12 }}
115 {{- end }}
116 resources:
117 {{- toYaml .Values.read.resources | nindent 12 }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300118 {{- with .Values.read.extraContainers }}
119 {{- toYaml . | nindent 8}}
120 {{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000121 {{- with .Values.read.affinity }}
122 affinity:
Mohammed Naser65cda132024-05-02 14:34:08 -0400123 {{- toYaml . | nindent 8 }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000124 {{- end }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300125 {{- with .Values.read.dnsConfig }}
126 dnsConfig:
127 {{- tpl . $ | nindent 8 }}
128 {{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000129 {{- with .Values.read.nodeSelector }}
130 nodeSelector:
131 {{- toYaml . | nindent 8 }}
132 {{- end }}
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300133 {{- with .Values.read.topologySpreadConstraints }}
134 topologySpreadConstraints:
135 {{- toYaml . | nindent 8 }}
136 {{- end }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000137 {{- with .Values.read.tolerations }}
138 tolerations:
139 {{- toYaml . | nindent 8 }}
140 {{- end }}
141 volumes:
142 - name: tmp
143 emptyDir: {}
144 - name: data
145 emptyDir: {}
146 - name: config
Giovanni Tirloni59219b62024-04-09 14:50:25 -0300147 {{- include "loki.configVolume" . | nindent 10 }}
Mohammed Naser8a2c8fb2023-02-19 17:23:55 +0000148 - name: runtime-config
149 configMap:
150 name: {{ template "loki.name" . }}-runtime
151 {{- if .Values.enterprise.enabled }}
152 - name: license
153 secret:
154 {{- if .Values.enterprise.useExternalLicense }}
155 secretName: {{ .Values.enterprise.externalLicenseName }}
156 {{- else }}
157 secretName: enterprise-logs-license
158 {{- end }}
159 {{- end }}
160 {{- with .Values.read.extraVolumes }}
161 {{- toYaml . | nindent 8 }}
162 {{- end }}
163{{- end }}