{{- if and (.Capabilities.APIVersions.Has "monitoring.coreos.com/v1") .Values.applicationSet.metrics.enabled .Values.applicationSet.metrics.serviceMonitor.enabled }} apiVersion: monitoring.coreos.com/v1 kind: ServiceMonitor metadata: name: {{ template "argo-cd.applicationSet.fullname" . }} namespace: {{ default (include "argo-cd.namespace" .) .Values.applicationSet.metrics.serviceMonitor.namespace | quote }} labels: {{- include "argo-cd.labels" (dict "context" . "component" .Values.applicationSet.name "name" .Values.applicationSet.name) | nindent 4 }} {{- with .Values.applicationSet.metrics.serviceMonitor.selector }} {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.applicationSet.metrics.serviceMonitor.additionalLabels }} {{- toYaml . | nindent 4 }} {{- end }} {{- with .Values.applicationSet.metrics.serviceMonitor.annotations }} annotations: {{- toYaml . | nindent 4 }} {{- end }} spec: endpoints: - port: {{ .Values.applicationSet.metrics.service.portName }} {{- with .Values.applicationSet.metrics.serviceMonitor.interval }} interval: {{ . }} {{- end }} {{- with .Values.applicationSet.metrics.serviceMonitor.scrapeTimeout }} scrapeTimeout: {{ . }} {{- end }} path: /metrics {{- with .Values.applicationSet.metrics.serviceMonitor.relabelings }} relabelings: {{- toYaml . | nindent 8 }} {{- end }} {{- with .Values.applicationSet.metrics.serviceMonitor.metricRelabelings }} metricRelabelings: {{- toYaml . | nindent 8 }} {{- end }} honorLabels: {{ .Values.applicationSet.metrics.serviceMonitor.honorLabels }} {{- with .Values.applicationSet.metrics.serviceMonitor.scheme }} scheme: {{ . }} {{- end }} {{- with .Values.applicationSet.metrics.serviceMonitor.tlsConfig }} tlsConfig: {{- toYaml . | nindent 8 }} {{- end }} namespaceSelector: matchNames: - {{ include "argo-cd.namespace" . }} selector: matchLabels: {{- include "argo-cd.selectorLabels" (dict "context" . "component" .Values.applicationSet.name "name" "metrics") | nindent 6 }} {{- end }}