# Copyright 2021 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
#
#      http://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:
  annotations:
    cert-manager.io/inject-ca-from: apigee-system/apigee-serving-cert
    certmanager.k8s.io/inject-ca-from: apigee-system/apigee-serving-cert
  name: apigee-mutating-webhook-configuration
webhooks:
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha1-apigeedatastore
  failurePolicy: Fail
  name: mapigeedatastore.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha1
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeedatastores
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha2-apigeeenvironment
  failurePolicy: Fail
  name: mapigeeenvironment.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha2
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeeenvironments
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha2-apigeeorganization
  failurePolicy: Fail
  name: mapigeeorganization.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha2
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeeorganizations
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha1-apigeeredis
  failurePolicy: Fail
  name: mapigeeredis.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha1
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeeredis
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha1-apigeeroute
  failurePolicy: Fail
  name: mapigeeroute.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha1
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeeroutes
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha2-apigeetelemetry
  failurePolicy: Fail
  name: mapigeetelemetry.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha2
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeetelemetrys
- clientConfig:
    caBundle: Cg==
    service:
      name: apigee-webhook-service
      namespace: apigee-system
      path: /mutate-apigee-cloud-google-com-v1alpha3-apigeedeployment
  failurePolicy: Fail
  name: mapigeedeployment.apigee.cloud.google.com
  #nandan fix
  admissionReviewVersions: ["v1beta1"]
  sideEffects: None
  rules:
  - apiGroups:
    - apigee.cloud.google.com
    apiVersions:
    - v1alpha3
    operations:
    - CREATE
    - UPDATE
    resources:
    - apigeedeployments
