daemonset.yaml 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. apiVersion: apps/v1
  2. kind: DaemonSet
  3. metadata:
  4. name: {{ template "promtail.fullname" . }}
  5. namespace: {{ .Release.Namespace }}
  6. labels:
  7. app: {{ template "promtail.name" . }}
  8. chart: {{ template "promtail.chart" . }}
  9. release: {{ .Release.Name }}
  10. heritage: {{ .Release.Service }}
  11. annotations:
  12. {{- toYaml .Values.annotations | nindent 4 }}
  13. spec:
  14. selector:
  15. matchLabels:
  16. app: {{ template "promtail.name" . }}
  17. release: {{ .Release.Name }}
  18. updateStrategy:
  19. {{- toYaml .Values.deploymentStrategy | nindent 4 }}
  20. template:
  21. metadata:
  22. labels:
  23. app: {{ template "promtail.name" . }}
  24. release: {{ .Release.Name }}
  25. {{- with .Values.podLabels }}
  26. {{- toYaml . | nindent 8 }}
  27. {{- end }}
  28. annotations:
  29. checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum }}
  30. {{- with .Values.podAnnotations }}
  31. {{- toYaml . | nindent 8 }}
  32. {{- end }}
  33. spec:
  34. serviceAccountName: {{ template "promtail.serviceAccountName" . }}
  35. {{- if .Values.priorityClassName }}
  36. priorityClassName: {{ .Values.priorityClassName }}
  37. {{- end }}
  38. {{- if .Values.initContainer.enabled }}
  39. initContainers:
  40. - name: init
  41. image: busybox
  42. command:
  43. - sh
  44. - -c
  45. - sysctl -w fs.inotify.max_user_instances={{ .Values.initContainer.fsInotifyMaxUserInstances }}
  46. securityContext:
  47. privileged: true
  48. {{- end }}
  49. {{- if .Values.image.pullSecrets }}
  50. imagePullSecrets:
  51. {{- range .Values.image.pullSecrets }}
  52. - name: {{ . }}
  53. {{- end}}
  54. {{- end }}
  55. containers:
  56. - name: promtail
  57. image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
  58. imagePullPolicy: {{ .Values.image.pullPolicy }}
  59. args:
  60. - "-config.file=/etc/promtail/promtail.yaml"
  61. {{- if not (or .Values.config.client.url .Values.config.clients) }}
  62. {{- if and .Values.loki.user .Values.loki.password }}
  63. - "-client.url={{ .Values.loki.serviceScheme }}://{{ .Values.loki.user }}:{{ .Values.loki.password }}@{{ include "loki.serviceName" . }}:{{ .Values.loki.servicePort }}/loki/api/v1/push"
  64. {{- else }}
  65. - "-client.url={{ .Values.loki.serviceScheme }}://{{ include "loki.serviceName" . }}:{{ .Values.loki.servicePort }}/loki/api/v1/push"
  66. {{- end }}
  67. {{- end }}
  68. {{- if .Values.extraCommandlineArgs }}
  69. {{- range .Values.extraCommandlineArgs }}
  70. - {{ . | quote }}
  71. {{- end }}
  72. {{- end }}
  73. volumeMounts:
  74. - name: config
  75. mountPath: /etc/promtail
  76. - name: run
  77. mountPath: /run/promtail
  78. {{- with .Values.volumeMounts }}
  79. {{- toYaml . | nindent 12 }}
  80. {{- end }}
  81. {{- with .Values.extraVolumeMounts }}
  82. {{- toYaml . | nindent 12 }}
  83. {{- end }}
  84. env:
  85. {{- with .Values.env }}
  86. {{- toYaml . | nindent 12 }}
  87. {{- end }}
  88. - name: HOSTNAME
  89. valueFrom:
  90. fieldRef:
  91. fieldPath: spec.nodeName
  92. ports:
  93. - containerPort: {{ .Values.config.server.http_listen_port }}
  94. name: http-metrics
  95. {{- if .Values.syslogService.enabled }}
  96. - containerPort: {{ .Values.syslogService.port }}
  97. name: syslog
  98. {{- end }}
  99. securityContext:
  100. {{- toYaml .Values.securityContext | nindent 12 }}
  101. {{- if .Values.livenessProbe }}
  102. livenessProbe:
  103. {{- toYaml .Values.livenessProbe | nindent 12 }}
  104. {{- end }}
  105. {{- if .Values.readinessProbe }}
  106. readinessProbe:
  107. {{- toYaml .Values.readinessProbe | nindent 12 }}
  108. {{- end }}
  109. resources:
  110. {{- toYaml .Values.resources | nindent 12 }}
  111. nodeSelector:
  112. {{- toYaml .Values.nodeSelector | nindent 8 }}
  113. affinity:
  114. {{- toYaml .Values.affinity | nindent 8 }}
  115. tolerations:
  116. {{- toYaml .Values.tolerations | nindent 8 }}
  117. volumes:
  118. - name: config
  119. configMap:
  120. name: {{ template "promtail.fullname" . }}
  121. - name: run
  122. hostPath:
  123. path: /run/promtail
  124. {{- with .Values.volumes }}
  125. {{- toYaml . | nindent 8 }}
  126. {{- end }}
  127. {{- with .Values.extraVolumes }}
  128. {{- toYaml . | nindent 8 }}
  129. {{- end }}