deployment-compactor.yaml 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. {{- if .Values.compactor.enabled }}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "loki.compactorFullname" . }}
  6. namespace: {{ .Release.Namespace }}
  7. labels:
  8. {{- include "loki.compactorLabels" . | nindent 4 }}
  9. {{- with .Values.loki.annotations }}
  10. annotations:
  11. {{- toYaml . | nindent 4 }}
  12. {{- end }}
  13. spec:
  14. replicas: 1
  15. revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
  16. strategy:
  17. type: Recreate
  18. selector:
  19. matchLabels:
  20. {{- include "loki.compactorSelectorLabels" . | nindent 6 }}
  21. template:
  22. metadata:
  23. annotations:
  24. {{- include "loki.config.checksum" . | nindent 8 }}
  25. {{- with .Values.loki.podAnnotations }}
  26. {{- toYaml . | nindent 8 }}
  27. {{- end }}
  28. {{- with .Values.compactor.podAnnotations }}
  29. {{- toYaml . | nindent 8 }}
  30. {{- end }}
  31. labels:
  32. {{- include "loki.compactorSelectorLabels" . | nindent 8 }}
  33. app.kubernetes.io/part-of: memberlist
  34. {{- with .Values.loki.podLabels }}
  35. {{- toYaml . | nindent 8 }}
  36. {{- end }}
  37. {{- with .Values.compactor.podLabels }}
  38. {{- toYaml . | nindent 8 }}
  39. {{- end }}
  40. spec:
  41. serviceAccountName: {{ include "loki.compactorServiceAccountName" . }}
  42. {{- with .Values.imagePullSecrets }}
  43. imagePullSecrets:
  44. {{- toYaml . | nindent 8 }}
  45. {{- end }}
  46. {{- with .Values.compactor.hostAliases }}
  47. hostAliases:
  48. {{- toYaml . | nindent 8 }}
  49. {{- end }}
  50. {{- include "loki.compactorPriorityClassName" . | nindent 6 }}
  51. securityContext:
  52. {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
  53. terminationGracePeriodSeconds: {{ .Values.compactor.terminationGracePeriodSeconds }}
  54. {{- with .Values.compactor.initContainers }}
  55. initContainers:
  56. {{- toYaml . | nindent 8 }}
  57. {{- end }}
  58. containers:
  59. - name: compactor
  60. image: {{ include "loki.compactorImage" . }}
  61. imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
  62. {{- if or .Values.loki.command .Values.compactor.command }}
  63. command:
  64. - {{ coalesce .Values.compactor.command .Values.loki.command | quote }}
  65. {{- end }}
  66. args:
  67. - -config.file=/etc/loki/config/config.yaml
  68. - -target=compactor
  69. - -boltdb.shipper.compactor.working-directory=/var/loki/compactor
  70. {{- with .Values.compactor.extraArgs }}
  71. {{- toYaml . | nindent 12 }}
  72. {{- end }}
  73. ports:
  74. - name: http
  75. containerPort: 3100
  76. protocol: TCP
  77. - name: grpc
  78. containerPort: 9095
  79. protocol: TCP
  80. - name: http-memberlist
  81. containerPort: 7946
  82. protocol: TCP
  83. {{- with .Values.compactor.extraEnv }}
  84. env:
  85. {{- toYaml . | nindent 12 }}
  86. {{- end }}
  87. {{- with .Values.compactor.extraEnvFrom }}
  88. envFrom:
  89. {{- toYaml . | nindent 12 }}
  90. {{- end }}
  91. securityContext:
  92. {{- toYaml .Values.loki.containerSecurityContext | nindent 12 }}
  93. readinessProbe:
  94. {{- toYaml .Values.loki.readinessProbe | nindent 12 }}
  95. livenessProbe:
  96. {{- toYaml .Values.loki.livenessProbe | nindent 12 }}
  97. volumeMounts:
  98. - name: temp
  99. mountPath: /tmp
  100. - name: config
  101. mountPath: /etc/loki/config
  102. - name: runtime-config
  103. mountPath: /var/{{ include "loki.name" . }}-runtime
  104. - name: data
  105. mountPath: /var/loki
  106. {{- with .Values.compactor.extraVolumeMounts }}
  107. {{- toYaml . | nindent 12 }}
  108. {{- end }}
  109. resources:
  110. {{- toYaml .Values.compactor.resources | nindent 12 }}
  111. {{- if .Values.compactor.extraContainers }}
  112. {{- toYaml .Values.compactor.extraContainers | nindent 8}}
  113. {{- end }}
  114. {{- with .Values.compactor.affinity }}
  115. affinity:
  116. {{- tpl . $ | nindent 8 }}
  117. {{- end }}
  118. {{- with .Values.compactor.nodeSelector }}
  119. nodeSelector:
  120. {{- toYaml . | nindent 8 }}
  121. {{- end }}
  122. {{- with .Values.compactor.tolerations }}
  123. tolerations:
  124. {{- toYaml . | nindent 8 }}
  125. {{- end }}
  126. volumes:
  127. - name: temp
  128. emptyDir: {}
  129. - name: config
  130. {{- if .Values.loki.existingSecretForConfig }}
  131. secret:
  132. secretName: {{ .Values.loki.existingSecretForConfig }}
  133. {{- else if .Values.loki.configAsSecret }}
  134. secret:
  135. secretName: {{ include "loki.fullname" . }}-config
  136. {{- else }}
  137. configMap:
  138. name: {{ include "loki.fullname" . }}
  139. {{- end }}
  140. - name: runtime-config
  141. configMap:
  142. name: {{ template "loki.fullname" . }}-runtime
  143. - name: data
  144. {{- if .Values.compactor.persistence.enabled }}
  145. persistentVolumeClaim:
  146. claimName: data-{{ include "loki.compactorFullname" . }}
  147. {{- else }}
  148. emptyDir: {}
  149. {{- end }}
  150. {{- with .Values.compactor.extraVolumes }}
  151. {{- toYaml . | nindent 8 }}
  152. {{- end }}
  153. {{- end }}