servicemonitor.yaml 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. {{- if .Values.prometheus.monitor.enabled }}
  2. apiVersion: monitoring.coreos.com/v1
  3. kind: ServiceMonitor
  4. metadata:
  5. name: {{ template "kube-state-metrics.fullname" . }}
  6. namespace: {{ template "kube-state-metrics.namespace" . }}
  7. labels:
  8. {{- include "kube-state-metrics.labels" . | indent 4 }}
  9. {{- with .Values.prometheus.monitor.additionalLabels }}
  10. {{- toYaml . | nindent 4 }}
  11. {{- end }}
  12. spec:
  13. jobLabel: {{ default "app.kubernetes.io/name" .Values.prometheus.monitor.jobLabel }}
  14. {{- with .Values.prometheus.monitor.targetLabels }}
  15. targetLabels:
  16. {{- toYaml . | trim | nindent 4 }}
  17. {{- end }}
  18. {{- with .Values.prometheus.monitor.podTargetLabels }}
  19. podTargetLabels:
  20. {{- toYaml . | trim | nindent 4 }}
  21. {{- end }}
  22. {{- include "servicemonitor.scrapeLimits" .Values.prometheus.monitor | indent 2 }}
  23. selector:
  24. matchLabels:
  25. {{- with .Values.prometheus.monitor.selectorOverride }}
  26. {{- toYaml . | nindent 6 }}
  27. {{- else }}
  28. {{- include "kube-state-metrics.selectorLabels" . | indent 6 }}
  29. {{- end }}
  30. endpoints:
  31. - port: http
  32. {{- if .Values.prometheus.monitor.interval }}
  33. interval: {{ .Values.prometheus.monitor.interval }}
  34. {{- end }}
  35. {{- if .Values.prometheus.monitor.scrapeTimeout }}
  36. scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }}
  37. {{- end }}
  38. {{- if .Values.prometheus.monitor.proxyUrl }}
  39. proxyUrl: {{ .Values.prometheus.monitor.proxyUrl}}
  40. {{- end }}
  41. {{- if .Values.prometheus.monitor.honorLabels }}
  42. honorLabels: true
  43. {{- end }}
  44. {{- if .Values.prometheus.monitor.metricRelabelings }}
  45. metricRelabelings:
  46. {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }}
  47. {{- end }}
  48. {{- if .Values.prometheus.monitor.relabelings }}
  49. relabelings:
  50. {{- toYaml .Values.prometheus.monitor.relabelings | nindent 8 }}
  51. {{- end }}
  52. {{- if .Values.prometheus.monitor.scheme }}
  53. scheme: {{ .Values.prometheus.monitor.scheme }}
  54. {{- end }}
  55. {{- if .Values.prometheus.monitor.tlsConfig }}
  56. tlsConfig:
  57. {{- toYaml .Values.prometheus.monitor.tlsConfig | nindent 8 }}
  58. {{- end }}
  59. {{- if .Values.selfMonitor.enabled }}
  60. - port: metrics
  61. {{- if .Values.prometheus.monitor.interval }}
  62. interval: {{ .Values.prometheus.monitor.interval }}
  63. {{- end }}
  64. {{- if .Values.prometheus.monitor.scrapeTimeout }}
  65. scrapeTimeout: {{ .Values.prometheus.monitor.scrapeTimeout }}
  66. {{- end }}
  67. {{- if .Values.prometheus.monitor.proxyUrl }}
  68. proxyUrl: {{ .Values.prometheus.monitor.proxyUrl}}
  69. {{- end }}
  70. {{- if .Values.prometheus.monitor.honorLabels }}
  71. honorLabels: true
  72. {{- end }}
  73. {{- if .Values.prometheus.monitor.metricRelabelings }}
  74. metricRelabelings:
  75. {{- toYaml .Values.prometheus.monitor.metricRelabelings | nindent 8 }}
  76. {{- end }}
  77. {{- if .Values.prometheus.monitor.relabelings }}
  78. relabelings:
  79. {{- toYaml .Values.prometheus.monitor.relabelings | nindent 8 }}
  80. {{- end }}
  81. {{- if .Values.prometheus.monitor.scheme }}
  82. scheme: {{ .Values.prometheus.monitor.scheme }}
  83. {{- end }}
  84. {{- if .Values.prometheus.monitor.tlsConfig }}
  85. tlsConfig:
  86. {{- toYaml .Values.prometheus.monitor.tlsConfig | nindent 8 }}
  87. {{- end }}
  88. {{- end }}
  89. {{- end }}