Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 1 | {{- $isSimpleScalable := eq (include "loki.deployment.isScalable" .) "true" -}} |
| 2 | {{- if and $isSimpleScalable (not .Values.read.legacyReadTarget ) }} |
| 3 | --- |
| 4 | apiVersion: apps/v1 |
| 5 | kind: Deployment |
| 6 | metadata: |
| 7 | name: {{ include "loki.readFullname" . }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 8 | namespace: {{ $.Release.Namespace }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 9 | labels: |
| 10 | app.kubernetes.io/part-of: memberlist |
| 11 | {{- include "loki.readLabels" . | nindent 4 }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 12 | {{- 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 Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 21 | spec: |
| 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 36 | checksum/config: {{ include (print .Template.BasePath "/config.yaml") . | sha256sum }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 37 | {{- 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 74 | - -common.compactor-grpc-address={{ include "loki.backendFullname" . }}.{{ .Release.Namespace }}.svc.{{ .Values.global.clusterDomain }}:{{ .Values.loki.server.grpc_listen_port }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 75 | {{- with .Values.read.extraArgs }} |
| 76 | {{- toYaml . | nindent 12 }} |
| 77 | {{- end }} |
| 78 | ports: |
| 79 | - name: http-metrics |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 80 | containerPort: {{ .Values.loki.server.http_listen_port }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 81 | protocol: TCP |
| 82 | - name: grpc |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 83 | containerPort: {{ .Values.loki.server.grpc_listen_port }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 84 | 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 118 | {{- with .Values.read.extraContainers }} |
| 119 | {{- toYaml . | nindent 8}} |
| 120 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 121 | {{- with .Values.read.affinity }} |
| 122 | affinity: |
Mohammed Naser | 65cda13 | 2024-05-02 14:34:08 -0400 | [diff] [blame] | 123 | {{- toYaml . | nindent 8 }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 124 | {{- end }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 125 | {{- with .Values.read.dnsConfig }} |
| 126 | dnsConfig: |
| 127 | {{- tpl . $ | nindent 8 }} |
| 128 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 129 | {{- with .Values.read.nodeSelector }} |
| 130 | nodeSelector: |
| 131 | {{- toYaml . | nindent 8 }} |
| 132 | {{- end }} |
Giovanni Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 133 | {{- with .Values.read.topologySpreadConstraints }} |
| 134 | topologySpreadConstraints: |
| 135 | {{- toYaml . | nindent 8 }} |
| 136 | {{- end }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 137 | {{- 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 Tirloni | 59219b6 | 2024-04-09 14:50:25 -0300 | [diff] [blame] | 147 | {{- include "loki.configVolume" . | nindent 10 }} |
Mohammed Naser | 8a2c8fb | 2023-02-19 17:23:55 +0000 | [diff] [blame] | 148 | - 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 }} |