servicemonitor.yaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. {{- /*
  2. Copyright Broadcom, Inc. All Rights Reserved.
  3. SPDX-License-Identifier: APACHE-2.0
  4. */}}
  5. {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
  6. apiVersion: monitoring.coreos.com/v1
  7. kind: ServiceMonitor
  8. metadata:
  9. name: {{ template "common.names.fullname" . }}
  10. namespace: {{ default .Release.Namespace .Values.metrics.serviceMonitor.namespace | quote }}
  11. labels: {{- include "common.labels.standard" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 4 }}
  12. app.kubernetes.io/component: metrics
  13. {{- if .Values.metrics.serviceMonitor.additionalLabels }}
  14. {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $ ) | nindent 4 }}
  15. {{- end }}
  16. {{- if .Values.commonAnnotations }}
  17. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  18. {{- end }}
  19. spec:
  20. {{- if .Values.metrics.serviceMonitor.jobLabel }}
  21. jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
  22. {{- end }}
  23. selector:
  24. matchLabels: {{- include "common.labels.matchLabels" ( dict "customLabels" .Values.commonLabels "context" $ ) | nindent 6 }}
  25. {{- if .Values.metrics.serviceMonitor.selector }}
  26. {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
  27. {{- end }}
  28. app.kubernetes.io/component: metrics
  29. endpoints:
  30. - port: http-metrics
  31. path: "/metrics"
  32. {{- if .Values.metrics.serviceMonitor.interval }}
  33. interval: {{ .Values.metrics.serviceMonitor.interval }}
  34. {{- end }}
  35. {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
  36. scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
  37. {{- end }}
  38. {{- if .Values.metrics.serviceMonitor.relabelings }}
  39. relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.relabelings "context" $) | nindent 6 }}
  40. {{- end }}
  41. {{- if .Values.metrics.serviceMonitor.metricRelabelings }}
  42. metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 6 }}
  43. {{- end }}
  44. {{- if .Values.metrics.serviceMonitor.honorLabels }}
  45. honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
  46. {{- end }}
  47. {{- if .Values.metrics.serviceMonitor.scheme }}
  48. scheme: {{ .Values.metrics.serviceMonitor.scheme }}
  49. {{- end }}
  50. {{- if .Values.metrics.serviceMonitor.tlsConfig }}
  51. tlsConfig: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.tlsConfig "context" $ ) | nindent 8 }}
  52. {{- end }}
  53. namespaceSelector:
  54. matchNames:
  55. - {{ template "zookeeper.namespace" . }}
  56. {{- end }}