jenkins-master-servicemonitor.yaml 1.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
{{- if and .Values.master.prometheus.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor

metadata:
  name: {{ template "jenkins.fullname" . }}
{{- if .Values.master.prometheus.serviceMonitorNamespace }}
  namespace: {{ .Values.master.prometheus.serviceMonitorNamespace }}
{{- else }}
  namespace: {{ template "jenkins.namespace" . }}
{{- end }}
  labels:
    "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
    "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}"
    "app.kubernetes.io/managed-by": "{{ .Release.Service }}"
    "app.kubernetes.io/instance": "{{ .Release.Name }}"
    "app.kubernetes.io/component": "{{ .Values.master.componentName }}"
    {{- range $key, $val := .Values.master.prometheus.serviceMonitorAdditionalLabels }}
    {{ $key }}: {{ $val | quote }}
    {{- end}}

spec:
  endpoints:
  - interval: {{ .Values.master.prometheus.scrapeInterval }}
    port: http
    path: {{ .Values.master.jenkinsUriPrefix }}{{ .Values.master.prometheus.scrapeEndpoint }}
  jobLabel: {{ template "jenkins.fullname" . }}
  namespaceSelector:
    matchNames:
    - "{{ template "jenkins.namespace" $ }}"
  selector:
    matchLabels:
      "app.kubernetes.io/name": '{{ template "jenkins.name" .}}'
      "helm.sh/chart": "{{ .Chart.Name }}-{{ .Chart.Version }}"
      "app.kubernetes.io/instance": "{{ .Release.Name }}"
      "app.kubernetes.io/component": "{{ .Values.master.componentName }}"
{{- end }}