servicemonitor.yaml 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
  2. apiVersion: monitoring.coreos.com/v1
  3. kind: ServiceMonitor
  4. metadata:
  5. name: {{ template "common.names.fullname" . }}
  6. {{- if .Values.metrics.serviceMonitor.namespace }}
  7. namespace: {{ .Values.metrics.serviceMonitor.namespace }}
  8. {{- else }}
  9. namespace: {{ .Release.Namespace }}
  10. {{- end }}
  11. labels: {{- include "common.labels.standard" . | nindent 4 }}
  12. app.kubernetes.io/component: zookeeper
  13. {{- range $key, $value := .Values.metrics.serviceMonitor.selector }}
  14. {{ $key }}: {{ $value | quote }}
  15. {{- end }}
  16. {{- if .Values.commonLabels }}
  17. {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
  18. {{- end }}
  19. {{- if .Values.commonAnnotations }}
  20. annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
  21. {{- end }}
  22. spec:
  23. selector:
  24. matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
  25. app.kubernetes.io/component: zookeeper
  26. endpoints:
  27. - port: tcp-metrics
  28. path: "/metrics"
  29. {{- if .Values.metrics.serviceMonitor.interval }}
  30. interval: {{ .Values.metrics.serviceMonitor.interval }}
  31. {{- end }}
  32. {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
  33. scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
  34. {{- end }}
  35. namespaceSelector:
  36. matchNames:
  37. - {{ template "zookeeper.namespace" . }}
  38. {{- end }}