{{- /*
Copyright Broadcom, Inc. All Rights Reserved.
SPDX-License-Identifier: APACHE-2.0
*/}}

{{- if and .Values.prometheus.enabled .Values.prometheus.additionalPrometheusRules }}
{{- range .Values.prometheus.additionalPrometheusRules }}
---
apiVersion: monitoring.coreos.com/v1
kind: PrometheusRule
metadata:
  name: {{ template "kube-prometheus.name" $ }}-{{ .name }}
  namespace: {{ include "common.names.namespace" $ | quote }}
  labels: {{ include "kube-prometheus.prometheus.labels" $ | nindent 4 }}
  {{- if $.Values.commonAnnotations }}
  annotations: {{- include "common.tplvalues.render" ( dict "value" $.Values.commonAnnotations "context" $ ) | nindent 4 }}
  {{- end }}
spec:
  groups: {{- toYaml .groups | nindent 4 }}
{{- end }}
{{- end }}
