deployment-ingester.yaml 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. {{- if eq .Values.ingester.kind "Deployment"}}
  2. apiVersion: apps/v1
  3. kind: Deployment
  4. metadata:
  5. name: {{ include "loki.ingesterFullname" . }}
  6. namespace: {{ .Release.Namespace }}
  7. labels:
  8. {{- include "loki.ingesterLabels" . | nindent 4 }}
  9. app.kubernetes.io/part-of: memberlist
  10. {{- with .Values.loki.annotations }}
  11. annotations:
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. spec:
  15. {{- if not .Values.ingester.autoscaling.enabled }}
  16. replicas: {{ .Values.ingester.replicas }}
  17. {{- end }}
  18. strategy:
  19. rollingUpdate:
  20. maxSurge: {{ .Values.ingester.maxSurge }}
  21. maxUnavailable: 1
  22. revisionHistoryLimit: {{ .Values.loki.revisionHistoryLimit }}
  23. selector:
  24. matchLabels:
  25. {{- include "loki.ingesterSelectorLabels" . | nindent 6 }}
  26. template:
  27. metadata:
  28. annotations:
  29. {{- include "loki.config.checksum" . | nindent 8 }}
  30. {{- with .Values.loki.podAnnotations }}
  31. {{- toYaml . | nindent 8 }}
  32. {{- end }}
  33. {{- with .Values.ingester.podAnnotations }}
  34. {{- toYaml . | nindent 8 }}
  35. {{- end }}
  36. labels:
  37. {{- include "loki.ingesterSelectorLabels" . | nindent 8 }}
  38. app.kubernetes.io/part-of: memberlist
  39. spec:
  40. {{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion }}
  41. {{- with .Values.ingester.topologySpreadConstraints }}
  42. topologySpreadConstraints:
  43. {{- tpl . $ | nindent 8 }}
  44. {{- end }}
  45. {{- end }}
  46. serviceAccountName: {{ include "loki.serviceAccountName" . }}
  47. {{- with .Values.imagePullSecrets }}
  48. imagePullSecrets:
  49. {{- toYaml . | nindent 8 }}
  50. {{- end }}
  51. {{- with .Values.ingester.hostAliases }}
  52. hostAliases:
  53. {{- toYaml . | nindent 8 }}
  54. {{- end }}
  55. {{- include "loki.ingesterPriorityClassName" . | nindent 6 }}
  56. securityContext:
  57. {{- toYaml .Values.loki.podSecurityContext | nindent 8 }}
  58. terminationGracePeriodSeconds: {{ .Values.ingester.terminationGracePeriodSeconds }}
  59. {{- with .Values.ingester.initContainers }}
  60. initContainers:
  61. {{- toYaml . | nindent 8 }}
  62. {{- end }}
  63. containers:
  64. - name: ingester
  65. image: {{ include "loki.ingesterImage" . }}
  66. imagePullPolicy: {{ .Values.loki.image.pullPolicy }}
  67. args:
  68. - -config.file=/etc/loki/config/config.yaml
  69. - -target=ingester
  70. {{- with .Values.ingester.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.ingester.extraEnv }}
  84. env:
  85. {{- toYaml . | nindent 12 }}
  86. {{- end }}
  87. {{- with .Values.ingester.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: config
  99. mountPath: /etc/loki/config
  100. - name: runtime-config
  101. mountPath: /var/{{ include "loki.name" . }}-runtime
  102. - name: data
  103. mountPath: /var/loki
  104. {{- with .Values.ingester.extraVolumeMounts }}
  105. {{- toYaml . | nindent 12 }}
  106. {{- end }}
  107. resources:
  108. {{- toYaml .Values.ingester.resources | nindent 12 }}
  109. {{- with .Values.ingester.lifecycle }}
  110. lifecycle:
  111. {{- toYaml . | nindent 12 }}
  112. {{- end }}
  113. {{- if .Values.ingester.extraContainers }}
  114. {{- toYaml .Values.ingester.extraContainers | nindent 8}}
  115. {{- end }}
  116. {{- with .Values.ingester.affinity }}
  117. affinity:
  118. {{- tpl . $ | nindent 8 }}
  119. {{- end }}
  120. {{- with .Values.ingester.nodeSelector }}
  121. nodeSelector:
  122. {{- toYaml . | nindent 8 }}
  123. {{- end }}
  124. {{- with .Values.ingester.tolerations }}
  125. tolerations:
  126. {{- toYaml . | nindent 8 }}
  127. {{- end }}
  128. volumes:
  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. {{- with .Values.ingester.extraVolumes }}
  144. {{- toYaml . | nindent 8 }}
  145. {{- end }}
  146. - name: data
  147. {{- if .Values.ingester.persistence.inMemory }}
  148. emptyDir:
  149. medium: Memory
  150. {{- if .Values.ingester.persistence.size }}
  151. sizeLimit: {{ .Values.ingester.persistence.size }}
  152. {{- end }}
  153. {{- else }}
  154. emptyDir: {}
  155. {{- end }}
  156. {{- end }}