|
| 1 | +{{- if .Values.compactor.enabled }} |
| 2 | +{{- if eq .Values.compactor.kind "StatefulSet"}} |
| 3 | +apiVersion: apps/v1 |
| 4 | +kind: StatefulSet |
| 5 | +metadata: |
| 6 | + name: {{ include "loki.compactorFullname" . }} |
| 7 | + namespace: {{ .Release.Namespace }} |
| 8 | + labels: |
| 9 | + {{- include "loki.compactorLabels" . | nindent 4 }} |
| 10 | + app.kubernetes.io/part-of: memberlist |
| 11 | + {{- with .Values.loki.annotations }} |
| 12 | + annotations: |
| 13 | + {{- toYaml . | nindent 4 }} |
| 14 | + {{- end }} |
| 15 | +spec: |
| 16 | + replicas: {{ .Values.compactor.replicas }} |
| 17 | + podManagementPolicy: Parallel |
| 18 | + updateStrategy: |
| 19 | + rollingUpdate: |
| 20 | + partition: 0 |
| 21 | + serviceName: {{ include "loki.compactorFullname" . }}-headless |
| 22 | + revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }} |
| 23 | + {{- if and (semverCompare ">= 1.23-0" .Capabilities.KubeVersion.Version) (.Values.compactor.persistence.enableStatefulSetAutoDeletePVC) }} |
| 24 | + persistentVolumeClaimRetentionPolicy: |
| 25 | + whenDeleted: {{ .Values.compactor.persistence.whenDeleted }} |
| 26 | + whenScaled: {{ .Values.compactor.persistence.whenScaled }} |
| 27 | + {{- end }} |
| 28 | + selector: |
| 29 | + matchLabels: |
| 30 | + {{- include "loki.compactorSelectorLabels" . | nindent 6 }} |
| 31 | + template: |
| 32 | + metadata: |
| 33 | + annotations: |
| 34 | + {{- include "loki.config.checksum" . | nindent 8 }} |
| 35 | + {{- with .Values.loki.podAnnotations }} |
| 36 | + {{- toYaml . | nindent 8 }} |
| 37 | + {{- end }} |
| 38 | + {{- with .Values.compactor.podAnnotations }} |
| 39 | + {{- toYaml . | nindent 8 }} |
| 40 | + {{- end }} |
| 41 | + labels: |
| 42 | + {{- include "loki.compactorSelectorLabels" . | nindent 8 }} |
| 43 | + app.kubernetes.io/part-of: memberlist |
| 44 | + {{- with .Values.loki.podLabels }} |
| 45 | + {{- toYaml . | nindent 8 }} |
| 46 | + {{- end }} |
| 47 | + {{- with .Values.compactor.podLabels }} |
| 48 | + {{- toYaml . | nindent 8 }} |
| 49 | + {{- end }} |
| 50 | + spec: |
| 51 | + {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }} |
| 52 | + {{- with .Values.compactor.topologySpreadConstraints }} |
| 53 | + topologySpreadConstraints: |
| 54 | + {{- tpl . $ | nindent 8 }} |
| 55 | + {{- end }} |
| 56 | + {{- end }} |
| 57 | + serviceAccountName: {{ include "loki.serviceAccountName" . }} |
| 58 | + {{- with .Values.imagePullSecrets }} |
| 59 | + imagePullSecrets: |
| 60 | + {{- toYaml . | nindent 8 }} |
| 61 | + {{- end }} |
| 62 | + {{- with .Values.compactor.hostAliases }} |
| 63 | + hostAliases: |
| 64 | + {{- toYaml . | nindent 8 }} |
| 65 | + {{- end }} |
| 66 | + {{- include "loki.compactorPriorityClassName" . | nindent 6 }} |
| 67 | + securityContext: |
| 68 | + {{- toYaml .Values.loki.podSecurityContext | nindent 8 }} |
| 69 | + terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }} |
| 70 | + {{- with .Values.compactor.initContainers }} |
| 71 | + initContainers: |
| 72 | + {{- toYaml . | nindent 8 }} |
| 73 | + {{- end }} |
| 74 | + containers: |
| 75 | + - name: compactor |
| 76 | + image: {{ include "loki.compactorImage" . }} |
| 77 | + imagePullPolicy: {{ .Values.loki.image.pullPolicy }} |
| 78 | + {{- if or .Values.loki.command .Values.compactor.command }} |
| 79 | + command: |
| 80 | + - {{ coalesce .Values.compactor.command .Values.loki.command | quote }} |
| 81 | + {{- end }} |
| 82 | + args: |
| 83 | + - -config.file=/etc/loki/config/config.yaml |
| 84 | + - -target=compactor |
| 85 | + {{- with .Values.compactor.extraArgs }} |
| 86 | + {{- toYaml . | nindent 12 }} |
| 87 | + {{- end }} |
| 88 | + ports: |
| 89 | + - name: http |
| 90 | + containerPort: 3100 |
| 91 | + protocol: TCP |
| 92 | + - name: grpc |
| 93 | + containerPort: 9095 |
| 94 | + protocol: TCP |
| 95 | + - name: http-memberlist |
| 96 | + containerPort: 7946 |
| 97 | + protocol: TCP |
| 98 | + {{- with .Values.compactor.extraEnv }} |
| 99 | + env: |
| 100 | + {{- toYaml . | nindent 12 }} |
| 101 | + {{- end }} |
| 102 | + {{- with .Values.compactor.extraEnvFrom }} |
| 103 | + envFrom: |
| 104 | + {{- toYaml . | nindent 12 }} |
| 105 | + {{- end }} |
| 106 | + securityContext: |
| 107 | + {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }} |
| 108 | + {{- include "loki.compactor.readinessProbe" . | nindent 10 }} |
| 109 | + {{- include "loki.compactor.livenessProbe" . | nindent 10 }} |
| 110 | + volumeMounts: |
| 111 | + - name: temp |
| 112 | + mountPath: /tmp |
| 113 | + - name: config |
| 114 | + mountPath: /etc/loki/config |
| 115 | + - name: runtime-config |
| 116 | + mountPath: /var/{{ include "loki.name" . }}-runtime |
| 117 | + - name: data |
| 118 | + mountPath: /var/loki |
| 119 | + {{- with .Values.compactor.extraVolumeMounts }} |
| 120 | + {{- toYaml . | nindent 12 }} |
| 121 | + {{- end }} |
| 122 | + {{- with .Values.compactor.resources }} |
| 123 | + resources: |
| 124 | + {{- toYaml . | nindent 12 }} |
| 125 | + {{- end }} |
| 126 | + {{- with .Values.compactor.lifecycle }} |
| 127 | + lifecycle: |
| 128 | + {{- toYaml . | nindent 12 }} |
| 129 | + {{- end }} |
| 130 | + {{- if .Values.compactor.extraContainers }} |
| 131 | + {{- toYaml .Values.compactor.extraContainers | nindent 8}} |
| 132 | + {{- end }} |
| 133 | + {{- with .Values.compactor.affinity }} |
| 134 | + affinity: |
| 135 | + {{- tpl . $ | nindent 8 }} |
| 136 | + {{- end }} |
| 137 | + {{- with .Values.compactor.nodeSelector }} |
| 138 | + nodeSelector: |
| 139 | + {{- toYaml . | nindent 8 }} |
| 140 | + {{- end }} |
| 141 | + {{- with .Values.compactor.tolerations }} |
| 142 | + tolerations: |
| 143 | + {{- toYaml . | nindent 8 }} |
| 144 | + {{- end }} |
| 145 | + volumes: |
| 146 | + - name: temp |
| 147 | + emptyDir: {} |
| 148 | + - name: config |
| 149 | + {{- if .Values.loki.existingSecretForConfig }} |
| 150 | + secret: |
| 151 | + secretName: {{ .Values.loki.existingSecretForConfig }} |
| 152 | + {{- else if .Values.loki.configAsSecret }} |
| 153 | + secret: |
| 154 | + secretName: {{ include "loki.fullname" . }}-config |
| 155 | + {{- else }} |
| 156 | + configMap: |
| 157 | + name: {{ include "loki.fullname" . }} |
| 158 | + {{- end }} |
| 159 | + - name: runtime-config |
| 160 | + configMap: |
| 161 | + name: {{ template "loki.fullname" . }}-runtime |
| 162 | + {{- if not .Values.compactor.persistence.enabled }} |
| 163 | + - name: data |
| 164 | + emptyDir: {} |
| 165 | + {{- end }} |
| 166 | + {{- with .Values.compactor.extraVolumes }} |
| 167 | + {{- toYaml . | nindent 8 }} |
| 168 | + {{- end }} |
| 169 | + {{- if .Values.compactor.persistence.enabled }} |
| 170 | + volumeClaimTemplates: |
| 171 | + {{- range .Values.compactor.persistence.claims }} |
| 172 | + - metadata: |
| 173 | + name: {{ .name }} |
| 174 | + {{- with .annotations }} |
| 175 | + annotations: |
| 176 | + {{- . | toYaml | nindent 10 }} |
| 177 | + {{- end }} |
| 178 | + spec: |
| 179 | + accessModes: |
| 180 | + - ReadWriteOnce |
| 181 | + {{- with .storageClass }} |
| 182 | + storageClassName: {{ if (eq "-" .) }}""{{ else }}{{ . }}{{ end }} |
| 183 | + {{- end }} |
| 184 | + resources: |
| 185 | + requests: |
| 186 | + storage: {{ .size | quote }} |
| 187 | + {{- end }} |
| 188 | + {{- end }} |
| 189 | +{{- end }} |
| 190 | +{{- end }} |
0 commit comments