github.com/spotahome/redis-operator@v1.2.4/charts/redisoperator/templates/monitoring.yaml (about)

     1  {{- if .Values.monitoring.enabled -}}
     2  {{- $fullName := include "chart.fullname" . -}}
     3  {{- $svcPort := .Values.service.port -}}
     4  {{- $data := dict "Chart" .Chart "Release" .Release "Values" .Values -}}
     5  apiVersion: v1
     6  kind: Service
     7  metadata:
     8    name: {{ $fullName }}-prometheus
     9    labels:
    10      prometheus: {{ .Values.monitoring.prometheus.name }}
    11      {{- include "chart.labels" $data | nindent 4 }}
    12  {{- if .Values.monitoring.serviceAnnotations }}
    13    annotations:
    14  {{ toYaml .Values.monitoring.serviceAnnotations | indent 4 }}
    15  {{- end }}
    16  spec:
    17    ports:
    18      - port: {{ $svcPort }}
    19        protocol: TCP
    20        name: metrics
    21        targetPort: metrics
    22    selector:
    23  {{- include "chart.selectorLabels" $data | nindent 4 }}
    24  
    25  ---
    26  {{- if .Values.monitoring.serviceMonitor -}}
    27  apiVersion: monitoring.coreos.com/v1 
    28  kind: ServiceMonitor
    29  metadata:
    30    name: {{ $fullName }}
    31    labels:
    32      prometheus: {{ .Values.monitoring.prometheus.name }}
    33      {{- include "chart.labels" $data | nindent 4 }}
    34  spec:
    35    selector:
    36      matchLabels:
    37        prometheus: {{ .Values.monitoring.prometheus.name }}
    38       {{- include "chart.selectorLabels" $data | nindent 6 }}
    39    namespaceSelector:
    40      matchNames:
    41      - {{ .Release.Namespace }}
    42    endpoints:
    43    - port: metrics
    44      interval: 15s
    45  {{- end -}}
    46  {{- end -}}