{{- if .Values.compactor.enabled }} apiVersion: apps/v1 kind: Deployment metadata: name: {{ include "loki.compactorFullname" . }} namespace: {{ .Release.Namespace }} labels: {{- include "loki.compactorLabels" . | nindent 4 }} {{- with .Values.loki.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: replicas: 1 revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} strategy: type: Recreate selector: matchLabels: {{- include "loki.compactorSelectorLabels" . | nindent 6 }} template: metadata: annotations: {{- include "loki.config.checksum" . | nindent 8 }} {{- with .Values.loki.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.compactor.podAnnotations }} {{- toYaml . | nindent 8 }} {{- end }} labels: {{- include "loki.compactorSelectorLabels" . | nindent 8 }} app.kubernetes.io/part-of: memberlist {{- with .Values.loki.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.compactor.podLabels }} {{- toYaml . | nindent 8 }} {{- end }} spec: serviceAccountName: {{ include "loki.compactorServiceAccountName" . }} {{- with .Values.imagePullSecrets }} imagePullSecrets: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.compactor.hostAliases }} hostAliases: {{- toYaml . | nindent 8 }} {{- end }} {{- include "loki.compactorPriorityClassName" . | nindent 6 }} securityContext: {{- toYaml .Values.loki.podSecurityContext | nindent 8 }} terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} {{- with .Values.compactor.initContainers }} initContainers: {{- toYaml . | nindent 8 }} {{- end }} containers: - name: compactor image: {{ include "loki.compactorImage" . }} imagePullPolicy: {{ .Values.loki.image.pullPolicy }} {{- if or .Values.loki.command .Values.compactor.command }} command: - {{ coalesce .Values.compactor.command .Values.loki.command | quote }} {{- end }} args: - -config.file=/etc/loki/config/config.yaml - -target=compactor - -boltdb.shipper.compactor.working-directory=/var/loki/compactor {{- with .Values.compactor.extraArgs }} {{- toYaml . | nindent 12 }} {{- end }} ports: - name: http containerPort: 3100 protocol: TCP - name: grpc containerPort: 9095 protocol: TCP - name: http-memberlist containerPort: 7946 protocol: TCP {{- with .Values.compactor.extraEnv }} env: {{- toYaml . | nindent 12 }} {{- end }} {{- with .Values.compactor.extraEnvFrom }} envFrom: {{- toYaml . | nindent 12 }} {{- end }} securityContext: {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} readinessProbe: {{- toYaml .Values.loki.readinessProbe | nindent 12 }} livenessProbe: {{- toYaml .Values.loki.livenessProbe | nindent 12 }} volumeMounts: - name: temp mountPath: /tmp - name: config mountPath: /etc/loki/config - name: runtime-config mountPath: /var/{{ include "loki.name" . }}-runtime - name: data mountPath: /var/loki {{- with .Values.compactor.extraVolumeMounts }} {{- toYaml . | nindent 12 }} {{- end }} resources: {{- toYaml .Values.compactor.resources | nindent 12 }} {{- if .Values.compactor.extraContainers }} {{- toYaml .Values.compactor.extraContainers | nindent 8}} {{- end }} {{- with .Values.compactor.affinity }} affinity: {{- tpl . $ | nindent 8 }} {{- end }} {{- with .Values.compactor.nodeSelector }} nodeSelector: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.compactor.tolerations }} tolerations: {{- toYaml . | nindent 8 }} {{- end }} volumes: - name: temp emptyDir: {} - name: config {{- if .Values.loki.existingSecretForConfig }} secret: secretName: {{ .Values.loki.existingSecretForConfig }} {{- else if .Values.loki.configAsSecret }} secret: secretName: {{ include "loki.fullname" . }}-config {{- else }} configMap: name: {{ include "loki.fullname" . }} {{- end }} - name: runtime-config configMap: name: {{ template "loki.fullname" . }}-runtime - name: data {{- if .Values.compactor.persistence.enabled }} persistentVolumeClaim: claimName: data-{{ include "loki.compactorFullname" . }} {{- else }} emptyDir: {} {{- end }} {{- with .Values.compactor.extraVolumes }} {{- toYaml . | nindent 8 }} {{- end }} {{- end }}