jenkins-controller-servicemonitor.yaml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. {{- if and .Values.controller.prometheus.enabled }}
  2. apiVersion: monitoring.coreos.com/v1
  3. kind: ServiceMonitor
  4. metadata:
  5. name: {{ template "jenkins.fullname" . }}
  6. {{- if .Values.controller.prometheus.serviceMonitorNamespace }}
  7. namespace: {{ .Values.controller.prometheus.serviceMonitorNamespace }}
  8. {{- else }}
  9. namespace: {{ template "jenkins.namespace" . }}
  10. {{- end }}
  11. labels:
  12. "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
  13. {{- if .Values.renderHelmLabels }}
  14. "helm.sh/chart": "{{ template "jenkins.label" .}}"
  15. {{- end }}
  16. "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
  17. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  18. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  19. {{- range $key, $val := .Values.controller.prometheus.serviceMonitorAdditionalLabels }}
  20. {{ $key }}: {{ $val | quote }}
  21. {{- end}}
  22. spec:
  23. endpoints:
  24. - interval: {{ .Values.controller.prometheus.scrapeInterval }}
  25. port: http
  26. path: {{ .Values.controller.jenkinsUriPrefix }}{{ .Values.controller.prometheus.scrapeEndpoint }}
  27. {{- with .Values.controller.prometheus.relabelings }}
  28. relabelings:
  29. {{- toYaml . | nindent 6 }}
  30. {{- end }}
  31. {{- with .Values.controller.prometheus.metricRelabelings }}
  32. metricRelabelings:
  33. {{- toYaml . | nindent 6 }}
  34. {{- end }}
  35. jobLabel: {{ template "jenkins.fullname" . }}
  36. namespaceSelector:
  37. matchNames:
  38. - "{{ template "jenkins.namespace" $ }}"
  39. selector:
  40. matchLabels:
  41. "app.kubernetes.io/instance": "{{ .Release.Name }}"
  42. "app.kubernetes.io/component": "{{ .Values.controller.componentName }}"
  43. {{- end }}