{{ if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "cluster-autoscaler.fullname" . }}
  {{- if .Values.serviceMonitor.namespace }}
  namespace: {{ .Values.serviceMonitor.namespace }}
  {{- end }}
  labels:
    {{- range $key, $value := .Values.serviceMonitor.selector }}
      {{ $key }}: {{ $value | quote }}
    {{- end }}
spec:
  selector:
    matchLabels:
{{ include "cluster-autoscaler.instance-name" . | indent 6 }}
  endpoints:
  - port: {{ .Values.service.portName }}
    interval: {{ .Values.serviceMonitor.interval }}
    path: {{ .Values.serviceMonitor.path }}
  namespaceSelector:
    matchNames:
      - {{.Release.Namespace}}
{{ end }}

{{ if .Values.serviceMonitor.enabled }}
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
  name: {{ include "cluster-autoscaler.fullname" . }}
  {{- if .Values.serviceMonitor.namespace }}
  namespace: {{ .Values.serviceMonitor.namespace }}
  {{- end }}
  labels:
  {{- range $key, $value := .Values.serviceMonitor.selector }}
    {{ $key }}: {{ $value | quote }}
  {{- end }}
spec:
  selector:
    matchLabels:
{{ include "cluster-autoscaler.instance-name" . | indent 6 }}
  endpoints:
  - port: {{ .Values.service.portName }}
    interval: {{ .Values.serviceMonitor.interval }}
    path: {{ .Values.serviceMonitor.path }}
  namespaceSelector:
    matchNames:
      - {{.Release.Namespace}}
{{ end }}

Fix label indentation for the service monitor manifest
Fix label indentation for the service monitor manifest
