2
0

deploy.yaml 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. {{- if .Values.pushgateway.enabled -}}
  2. apiVersion: {{ template "prometheus.deployment.apiVersion" . }}
  3. kind: Deployment
  4. metadata:
  5. {{- if .Values.pushgateway.deploymentAnnotations }}
  6. annotations:
  7. {{ toYaml .Values.pushgateway.deploymentAnnotations | nindent 4 }}
  8. {{- end }}
  9. labels:
  10. {{- include "prometheus.pushgateway.labels" . | nindent 4 }}
  11. name: {{ template "prometheus.pushgateway.fullname" . }}
  12. {{ include "prometheus.namespace" . | indent 2 }}
  13. spec:
  14. selector:
  15. {{- if .Values.schedulerName }}
  16. schedulerName: "{{ .Values.schedulerName }}"
  17. {{- end }}
  18. matchLabels:
  19. {{- include "prometheus.pushgateway.matchLabels" . | nindent 6 }}
  20. replicas: {{ .Values.pushgateway.replicaCount }}
  21. {{- if .Values.pushgateway.strategy }}
  22. strategy:
  23. {{ toYaml .Values.pushgateway.strategy | trim | indent 4 }}
  24. {{ if eq .Values.pushgateway.strategy.type "Recreate" }}rollingUpdate: null{{ end }}
  25. {{- end }}
  26. template:
  27. metadata:
  28. {{- if .Values.pushgateway.podAnnotations }}
  29. annotations:
  30. {{ toYaml .Values.pushgateway.podAnnotations | nindent 8 }}
  31. {{- end }}
  32. labels:
  33. {{- include "prometheus.pushgateway.labels" . | nindent 8 }}
  34. {{- if .Values.pushgateway.podLabels }}
  35. {{ toYaml .Values.pushgateway.podLabels | nindent 8 }}
  36. {{- end }}
  37. spec:
  38. serviceAccountName: {{ template "prometheus.serviceAccountName.pushgateway" . }}
  39. {{- if .Values.pushgateway.extraInitContainers }}
  40. initContainers:
  41. {{ toYaml .Values.pushgateway.extraInitContainers | indent 8 }}
  42. {{- end }}
  43. {{- if .Values.pushgateway.priorityClassName }}
  44. priorityClassName: "{{ .Values.pushgateway.priorityClassName }}"
  45. {{- end }}
  46. containers:
  47. - name: {{ template "prometheus.name" . }}-{{ .Values.pushgateway.name }}
  48. image: "{{ .Values.pushgateway.image.repository }}:{{ .Values.pushgateway.image.tag }}"
  49. imagePullPolicy: "{{ .Values.pushgateway.image.pullPolicy }}"
  50. args:
  51. {{- range $key, $value := .Values.pushgateway.extraArgs }}
  52. {{- $stringvalue := toString $value }}
  53. {{- if eq $stringvalue "true" }}
  54. - --{{ $key }}
  55. {{- else }}
  56. - --{{ $key }}={{ $value }}
  57. {{- end }}
  58. {{- end }}
  59. ports:
  60. - containerPort: 9091
  61. livenessProbe:
  62. httpGet:
  63. {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
  64. path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/healthy
  65. {{- else }}
  66. path: /-/healthy
  67. {{- end }}
  68. port: 9091
  69. initialDelaySeconds: 10
  70. timeoutSeconds: 10
  71. readinessProbe:
  72. httpGet:
  73. {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
  74. path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/ready
  75. {{- else }}
  76. path: /-/ready
  77. {{- end }}
  78. port: 9091
  79. initialDelaySeconds: 10
  80. timeoutSeconds: 10
  81. resources:
  82. {{ toYaml .Values.pushgateway.resources | indent 12 }}
  83. {{- if .Values.pushgateway.persistentVolume.enabled }}
  84. volumeMounts:
  85. - name: storage-volume
  86. mountPath: "{{ .Values.pushgateway.persistentVolume.mountPath }}"
  87. subPath: "{{ .Values.pushgateway.persistentVolume.subPath }}"
  88. {{- end }}
  89. {{- if .Values.imagePullSecrets }}
  90. imagePullSecrets:
  91. {{ toYaml .Values.imagePullSecrets | indent 8 }}
  92. {{- end }}
  93. {{- if .Values.pushgateway.nodeSelector }}
  94. nodeSelector:
  95. {{ toYaml .Values.pushgateway.nodeSelector | indent 8 }}
  96. {{- end }}
  97. {{- with .Values.pushgateway.dnsConfig }}
  98. dnsConfig:
  99. {{ toYaml . | indent 8 }}
  100. {{- end }}
  101. {{- if .Values.pushgateway.securityContext }}
  102. securityContext:
  103. {{ toYaml .Values.pushgateway.securityContext | indent 8 }}
  104. {{- end }}
  105. {{- if .Values.pushgateway.tolerations }}
  106. tolerations:
  107. {{ toYaml .Values.pushgateway.tolerations | indent 8 }}
  108. {{- end }}
  109. {{- if .Values.pushgateway.affinity }}
  110. affinity:
  111. {{ toYaml .Values.pushgateway.affinity | indent 8 }}
  112. {{- end }}
  113. {{- if .Values.pushgateway.persistentVolume.enabled }}
  114. volumes:
  115. - name: storage-volume
  116. persistentVolumeClaim:
  117. claimName: {{ if .Values.pushgateway.persistentVolume.existingClaim }}{{ .Values.pushgateway.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.pushgateway.fullname" . }}{{- end }}
  118. {{- end -}}
  119. {{- end }}