_prometheus.tpl 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. {{- define "prometheus.workload" -}}
  2. workload:
  3. prometheus:
  4. enabled: true
  5. primary: true
  6. type: Deployment
  7. podSpec:
  8. hostNetwork: {{ .Values.prometheusNetwork.hostNetwork }}
  9. containers:
  10. prometheus:
  11. enabled: true
  12. primary: true
  13. imageSelector: image
  14. securityContext:
  15. runAsUser: {{ .Values.prometheusRunAs.user }}
  16. runAsGroup: {{ .Values.prometheusRunAs.group }}
  17. args:
  18. - --web.listen-address=0.0.0.0:{{ .Values.prometheusNetwork.apiPort }}
  19. - --storage.tsdb.path=/data
  20. - --config.file=/config/prometheus.yml
  21. - --storage.tsdb.retention.time={{ .Values.prometheusConfig.retentionTime }}
  22. {{ with .Values.prometheusConfig.retentionSize }}
  23. - --storage.tsdb.retention.size={{ . }}
  24. {{ end }}
  25. {{ if .Values.prometheusConfig.walCompression }}
  26. - --storage.tsdb.wal-compression
  27. {{ end }}
  28. {{ with .Values.prometheusConfig.additionalArgs }}
  29. extraArgs:
  30. {{ range $arg := . }}
  31. - {{ $arg | quote }}
  32. {{ end }}
  33. {{ end }}
  34. {{ with .Values.prometheusConfig.additionalEnvs }}
  35. env:
  36. {{ range $env := . }}
  37. {{ $env.name }}: {{ $env.value }}
  38. {{ end }}
  39. {{ end }}
  40. probes:
  41. liveness:
  42. enabled: true
  43. type: http
  44. port: {{ .Values.prometheusNetwork.apiPort }}
  45. path: /-/healthy
  46. readiness:
  47. enabled: true
  48. type: http
  49. port: {{ .Values.prometheusNetwork.apiPort }}
  50. path: /-/ready
  51. startup:
  52. enabled: true
  53. type: http
  54. port: {{ .Values.prometheusNetwork.apiPort }}
  55. path: /-/ready
  56. initContainers:
  57. {{- include "ix.v1.common.app.permissions" (dict "containerName" "01-permissions"
  58. "UID" .Values.prometheusRunAs.user
  59. "GID" .Values.prometheusRunAs.group
  60. "type" "install") | nindent 8 }}
  61. init-config:
  62. enabled: true
  63. type: init
  64. imageSelector: image
  65. resources:
  66. limits:
  67. cpu: 500m
  68. memory: 256Mi
  69. securityContext:
  70. runAsUser: {{ .Values.prometheusRunAs.user }}
  71. runAsGroup: {{ .Values.prometheusRunAs.group }}
  72. command: sh
  73. args:
  74. - -c
  75. - |
  76. if [ ! -f /config/prometheus.yml ]; then
  77. touch /config/prometheus.yml
  78. fi
  79. {{/* Service */}}
  80. service:
  81. prometheus:
  82. enabled: true
  83. primary: true
  84. type: NodePort
  85. targetSelector: prometheus
  86. ports:
  87. prometheus:
  88. enabled: true
  89. primary: true
  90. port: {{ .Values.prometheusNetwork.apiPort }}
  91. nodePort: {{ .Values.prometheusNetwork.apiPort }}
  92. targetSelector: prometheus
  93. {{/* Persistence */}}
  94. persistence:
  95. data:
  96. enabled: true
  97. type: {{ .Values.prometheusStorage.data.type }}
  98. datasetName: {{ .Values.prometheusStorage.data.datasetName | default "" }}
  99. hostPath: {{ .Values.prometheusStorage.data.hostPath | default "" }}
  100. targetSelector:
  101. prometheus:
  102. prometheus:
  103. mountPath: /data
  104. 01-permissions:
  105. mountPath: /mnt/directories/data
  106. config:
  107. enabled: true
  108. type: {{ .Values.prometheusStorage.config.type }}
  109. datasetName: {{ .Values.prometheusStorage.config.datasetName | default "" }}
  110. hostPath: {{ .Values.prometheusStorage.config.hostPath | default "" }}
  111. targetSelector:
  112. prometheus:
  113. prometheus:
  114. mountPath: /config
  115. 01-permissions:
  116. mountPath: /mnt/directories/export
  117. init-config:
  118. mountPath: /config
  119. {{- end -}}