deploy.yaml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. - --{{ $key }}={{ $value }}
  53. {{- end }}
  54. ports:
  55. - containerPort: 9091
  56. livenessProbe:
  57. httpGet:
  58. {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
  59. path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/healthy
  60. {{- else }}
  61. path: /-/healthy
  62. {{- end }}
  63. port: 9091
  64. initialDelaySeconds: 10
  65. timeoutSeconds: 10
  66. readinessProbe:
  67. httpGet:
  68. {{- if (index .Values "pushgateway" "extraArgs" "web.route-prefix") }}
  69. path: /{{ index .Values "pushgateway" "extraArgs" "web.route-prefix" }}/-/ready
  70. {{- else }}
  71. path: /-/ready
  72. {{- end }}
  73. port: 9091
  74. initialDelaySeconds: 10
  75. timeoutSeconds: 10
  76. resources:
  77. {{ toYaml .Values.pushgateway.resources | indent 12 }}
  78. {{- if .Values.pushgateway.persistentVolume.enabled }}
  79. volumeMounts:
  80. - name: storage-volume
  81. mountPath: "{{ .Values.pushgateway.persistentVolume.mountPath }}"
  82. subPath: "{{ .Values.pushgateway.persistentVolume.subPath }}"
  83. {{- end }}
  84. {{- if .Values.imagePullSecrets }}
  85. imagePullSecrets:
  86. {{ toYaml .Values.imagePullSecrets | indent 2 }}
  87. {{- end }}
  88. {{- if .Values.pushgateway.nodeSelector }}
  89. nodeSelector:
  90. {{ toYaml .Values.pushgateway.nodeSelector | indent 8 }}
  91. {{- end }}
  92. {{- if .Values.pushgateway.securityContext }}
  93. securityContext:
  94. {{ toYaml .Values.pushgateway.securityContext | indent 8 }}
  95. {{- end }}
  96. {{- if .Values.pushgateway.tolerations }}
  97. tolerations:
  98. {{ toYaml .Values.pushgateway.tolerations | indent 8 }}
  99. {{- end }}
  100. {{- if .Values.pushgateway.affinity }}
  101. affinity:
  102. {{ toYaml .Values.pushgateway.affinity | indent 8 }}
  103. {{- end }}
  104. {{- if .Values.pushgateway.persistentVolume.enabled }}
  105. volumes:
  106. - name: storage-volume
  107. persistentVolumeClaim:
  108. claimName: {{ if .Values.pushgateway.persistentVolume.existingClaim }}{{ .Values.pushgateway.persistentVolume.existingClaim }}{{- else }}{{ template "prometheus.pushgateway.fullname" . }}{{- end }}
  109. {{- end -}}
  110. {{- end }}