ingress-nginx-helm/charts/ingress-nginx/templates/controller-servicemonitor.yaml

34 lines
1.3 KiB
YAML
Raw Normal View History

2020-03-02 14:49:26 +00:00
{{- if and .Values.controller.metrics.enabled .Values.controller.metrics.serviceMonitor.enabled -}}
2020-02-24 19:25:57 +00:00
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: {{ include "ingress-nginx.controller.fullname" . }}
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.metrics.serviceMonitor.namespace }}
2020-02-24 19:25:57 +00:00
namespace: {{ .Values.controller.metrics.serviceMonitor.namespace }}
2020-03-02 14:49:26 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
labels:
{{- include "ingress-nginx.labels" . | nindent 4 }}
app.kubernetes.io/component: controller
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.metrics.serviceMonitor.additionalLabels }}
{{- toYaml .Values.controller.metrics.serviceMonitor.additionalLabels | nindent 4 }}
{{- end }}
2020-02-24 19:25:57 +00:00
spec:
endpoints:
- port: metrics
interval: {{ .Values.controller.metrics.serviceMonitor.scrapeInterval }}
2020-03-02 14:49:26 +00:00
{{- if .Values.controller.metrics.serviceMonitor.honorLabels }}
2020-02-24 19:25:57 +00:00
honorLabels: true
2020-03-02 14:49:26 +00:00
{{- end }}
{{- if .Values.controller.metrics.serviceMonitor.namespaceSelector }}
namespaceSelector: {{ toYaml .Values.controller.metrics.serviceMonitor.namespaceSelector | nindent 4 }}
{{ else }}
2020-02-24 19:25:57 +00:00
namespaceSelector:
matchNames:
- {{ .Release.Namespace }}
2020-03-02 14:49:26 +00:00
{{- end }}
2020-02-24 19:25:57 +00:00
selector:
matchLabels:
{{- include "ingress-nginx.selectorLabels" . | nindent 6 }}
app.kubernetes.io/component: controller
2020-02-24 19:25:57 +00:00
{{- end }}