statefulset-querier.yaml 5.9 KB

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