{{- if and .Values.prometheusOperator.admissionWebhooks.enabled }} apiVersion: admissionregistration.k8s.io/v1beta1 kind: MutatingWebhookConfiguration metadata: name: {{ template "kube-prometheus-stack.fullname" . }}-admission labels: app: {{ template "kube-prometheus-stack.name" $ }}-admission {{- include "kube-prometheus-stack.labels" $ | indent 4 }} webhooks: - name: prometheusrulemutate.monitoring.coreos.com {{- if .Values.prometheusOperator.admissionWebhooks.patch.enabled }} failurePolicy: Ignore {{- else }} failurePolicy: {{ .Values.prometheusOperator.admissionWebhooks.failurePolicy }} {{- end }} rules: - apiGroups: - monitoring.coreos.com apiVersions: - "*" resources: - prometheusrules operations: - CREATE - UPDATE clientConfig: service: namespace: {{ template "kube-prometheus-stack.namespace" . }} name: {{ template "kube-prometheus-stack.operator.fullname" $ }} path: /admission-prometheusrules/mutate {{- end }}