{{- if .Values.es.prometheus }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "kubezero-lib.fullname" . }}-es namespace: {{ .Release.Namespace }} labels: {{ include "kubezero-lib.labels" . | indent 4 }} release: metrics spec: endpoints: - basicAuth: username: elastic password: name: {{ template "kubezero-lib.fullname" $ }}-es-elastic-user key: elastic port: http path: /_prometheus/metrics selector: matchExpressions: - key: elasticsearch.k8s.elastic.co/statefulset-name operator: DoesNotExist matchLabels: common.k8s.elastic.co/type: elasticsearch elasticsearch.k8s.elastic.co/cluster-name: {{ template "kubezero-lib.fullname" $ }} {{- end }}