diff --git a/charts/apisix-ingress-controller/templates/servicemonitor.yaml b/charts/apisix-ingress-controller/templates/servicemonitor.yaml index f8dd9dcc..7f37908f 100644 --- a/charts/apisix-ingress-controller/templates/servicemonitor.yaml +++ b/charts/apisix-ingress-controller/templates/servicemonitor.yaml @@ -35,7 +35,9 @@ spec: {{- if .Values.serviceMonitor.interval }} interval: {{ .Values.serviceMonitor.interval }} {{- end }} - metricRelabelings: {{ .Values.serviceMonitor.metricRelabelings }} + {{- with .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: {{ toYaml . | nindent 6 }} + {{- end }} namespaceSelector: matchNames: - {{ template "apisix-ingress-controller.namespace" . }} diff --git a/charts/apisix/templates/service-monitor.yaml b/charts/apisix/templates/service-monitor.yaml index 87f7eded..bda6a1d5 100644 --- a/charts/apisix/templates/service-monitor.yaml +++ b/charts/apisix/templates/service-monitor.yaml @@ -41,5 +41,7 @@ spec: targetPort: prometheus path: {{ .Values.serviceMonitor.path }} interval: {{ .Values.serviceMonitor.interval }} - metricRelabelings: {{ .Values.serviceMonitor.metricRelabelings }} + {{- with .Values.serviceMonitor.metricRelabelings }} + metricRelabelings: {{ toYaml . | nindent 6 }} + {{- end }} {{- end }}