{{- /*
# Copyright 2022 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
*/}}
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: gmp-operator.gmp-system.monitoring.googleapis.com
  {{- if .Values.commonLabels }}
  labels:
    {{- include "prometheus-engine.labels" . | nindent 4 }}
  {{- end }}
webhooks:
- name: default.operatorconfigs.gmp-operator.gmp-system.monitoring.googleapis.com
  admissionReviewVersions:
  - v1
  clientConfig:
    # caBundle populated by operator.
    service:
      name: gmp-operator
      namespace: {{.Values.namespace.system}}
      port: 443
      path: /default/monitoring.googleapis.com/v1/operatorconfigs
  # Since this is re-applied at runtime by the operator's controllers
  # we can safely ignore any transient issues with the webhook server.
  failurePolicy: Ignore
  rules:
  - resources:
    - operatorconfigs
    apiGroups:
    - monitoring.googleapis.com
    apiVersions:
    - v1
    operations:
    - UPDATE
  sideEffects: None
