statefulset-index-gateway.yaml 5.6 KB

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