kube-state-metrics-servmon.yaml 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. {{- if and ((.Values.metaMonitoring).grafanaAgent).enabled .Values.metaMonitoring.grafanaAgent.metrics.scrapeK8s.enabled }}
  2. {{- with .Values.metaMonitoring.serviceMonitor }}
  3. {{- if .enabled }}
  4. apiVersion: monitoring.coreos.com/v1
  5. kind: ServiceMonitor
  6. metadata:
  7. name: {{ include "tempo.resourceName" (dict "ctx" $ "component" "k8s-ksm") }}
  8. namespace: {{ .namespace | default $.Release.Namespace | quote }}
  9. labels:
  10. {{- include "tempo.labels" (dict "ctx" $ "component" "meta-monitoring") | nindent 4 }}
  11. {{- with .labels }}
  12. {{- toYaml . | nindent 4 }}
  13. {{- end }}
  14. {{- with .annotations }}
  15. annotations:
  16. {{- toYaml . | nindent 4 }}
  17. {{- end }}
  18. spec:
  19. endpoints:
  20. - port: http-metrics
  21. metricRelabelings:
  22. - action: keep
  23. regex: {{ include "tempo.resourceName" (dict "ctx" $) }}.*
  24. sourceLabels:
  25. - deployment
  26. - statefulset
  27. - pod
  28. separator: ''
  29. path: /metrics
  30. honorLabels: true # retain namespace label from kube-state-metrics
  31. {{- with .scrapeTimeout }}
  32. scrapeTimeout: {{ . }}
  33. {{- end }}
  34. {{- with ((((($.Values).metaMonitoring).grafanaAgent).metrics).scrapeK8s).kubeStateMetrics }}
  35. namespaceSelector:
  36. matchNames:
  37. - {{ .namespace }}
  38. selector:
  39. matchLabels:
  40. {{- toYaml .labelSelectors | nindent 6 }}
  41. {{- end -}}
  42. {{- end -}}
  43. {{- end -}}
  44. {{- end -}}