servicemonitor-jmx-metrics.yaml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. {{- if and .Values.metrics.jmx.enabled .Values.metrics.serviceMonitor.enabled }}
  2. apiVersion: monitoring.coreos.com/v1
  3. kind: ServiceMonitor
  4. metadata:
  5. name: {{ printf "%s-jmx-metrics" (include "common.names.fullname" .) }}
  6. {{- if .Values.metrics.serviceMonitor.namespace }}
  7. namespace: {{ .Values.metrics.serviceMonitor.namespace }}
  8. {{- else }}
  9. namespace: {{ .Release.Namespace | quote }}
  10. {{- end }}
  11. labels: {{- include "common.labels.standard" . | nindent 4 }}
  12. app.kubernetes.io/component: metrics
  13. {{- if .Values.metrics.serviceMonitor.labels }}
  14. {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.labels "context" $ ) | nindent 4 }}
  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. {{- if .Values.metrics.serviceMonitor.jobLabel }}
  24. jobLabel: {{ .Values.metrics.serviceMonitor.jobLabel }}
  25. {{- end }}
  26. selector:
  27. matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
  28. {{- if .Values.metrics.serviceMonitor.selector }}
  29. {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.selector "context" $) | nindent 6 }}
  30. {{- end }}
  31. app.kubernetes.io/component: metrics
  32. endpoints:
  33. - port: http-metrics
  34. path: "/"
  35. {{- if .Values.metrics.serviceMonitor.interval }}
  36. interval: {{ .Values.metrics.serviceMonitor.interval }}
  37. {{- end }}
  38. {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
  39. scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
  40. {{- end }}
  41. {{- if .Values.metrics.serviceMonitor.relabelings }}
  42. relabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.relabelings "context" $) | nindent 6 }}
  43. {{- end }}
  44. {{- if .Values.metrics.serviceMonitor.metricRelabelings }}
  45. metricRelabelings: {{- include "common.tplvalues.render" ( dict "value" .Values.metrics.serviceMonitor.metricRelabelings "context" $) | nindent 6 }}
  46. {{- end }}
  47. {{- if .Values.metrics.serviceMonitor.honorLabels }}
  48. honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
  49. {{- end }}
  50. namespaceSelector:
  51. matchNames:
  52. - {{ .Release.Namespace }}
  53. {{- end }}