github.com/aquasecurity/trivy-iac@v0.8.1-0.20240127024015-3d8e412cf0ab/pkg/scanners/helm/test/mysql/templates/servicemonitor.yaml (about)

     1  {{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }}
     2  apiVersion: monitoring.coreos.com/v1
     3  kind: ServiceMonitor
     4  metadata:
     5    name: {{ include "common.names.fullname" . }}
     6    {{- if .Values.metrics.serviceMonitor.namespace }}
     7    namespace: {{ .Values.metrics.serviceMonitor.namespace }}
     8    {{- else }}
     9    namespace: {{ .Release.Namespace }}
    10    {{- end }}
    11    labels: {{- include "common.labels.standard" . | nindent 4 }}
    12      {{- if .Values.commonLabels }}
    13      {{- include "common.tplvalues.render" ( dict "value" .Values.commonLabels "context" $ ) | nindent 4 }}
    14      {{- end }}
    15      {{- if .Values.metrics.serviceMonitor.additionalLabels }}
    16      {{- include "common.tplvalues.render" (dict "value" .Values.metrics.serviceMonitor.additionalLabels "context" $) | nindent 4 }}
    17      {{- end }}
    18    {{- if .Values.commonAnnotations }}
    19    annotations: {{- include "common.tplvalues.render" ( dict "value" .Values.commonAnnotations "context" $ ) | nindent 4 }}
    20    {{- end }}
    21  spec:
    22    endpoints:
    23      - port: metrics
    24        {{- if .Values.metrics.serviceMonitor.interval }}
    25        interval: {{ .Values.metrics.serviceMonitor.interval }}
    26        {{- end }}
    27        {{- if .Values.metrics.serviceMonitor.scrapeTimeout }}
    28        scrapeTimeout: {{ .Values.metrics.serviceMonitor.scrapeTimeout }}
    29        {{- end }}
    30        {{- if .Values.metrics.serviceMonitor.honorLabels }}
    31        honorLabels: {{ .Values.metrics.serviceMonitor.honorLabels }}
    32        {{- end }}
    33        {{- if .Values.metrics.serviceMonitor.relabellings }}
    34        metricRelabelings: {{- toYaml .Values.metrics.serviceMonitor.relabellings | nindent 6 }}
    35        {{- end }}
    36    namespaceSelector:
    37      matchNames:
    38        - {{ .Release.Namespace }}
    39    selector:
    40      matchLabels: {{- include "common.labels.matchLabels" . | nindent 6 }}
    41        app.kubernetes.io/component: metrics
    42  {{- end }}