---
apiVersion: admissionregistration.k8s.io/v1beta1
kind: MutatingWebhookConfiguration
metadata:
  name: {{.SRIOVMutatingWebhookName}}
  namespace: {{.Namespace}}
  annotations:
    service.beta.openshift.io/inject-cabundle: "true"
webhooks:
  - name: operator-webhook.sriovnetwork.openshift.io
    failurePolicy: Fail
    clientConfig:
      service:
        name: operator-webhook-service
        namespace: {{.Namespace}}
        path: "/mutating-custom-resource"
    rules:
      - operations: [ "CREATE", "UPDATE" ]
        apiGroups: ["sriovnetwork.openshift.io"]
        apiVersions: ["v1"]
        resources: ["sriovnetworknodepolicies"]

---
apiVersion: admissionregistration.k8s.io/v1beta1
kind: ValidatingWebhookConfiguration
metadata:
  name: {{.SRIOVMutatingWebhookName}}
  namespace: {{.Namespace}}
  annotations:
    service.beta.openshift.io/inject-cabundle: "true"
webhooks:
  - name: operator-webhook.sriovnetwork.openshift.io
    failurePolicy: Fail
    clientConfig:
      service:
        name: operator-webhook-service
        namespace: {{.Namespace}}
        path: "/validating-custom-resource"
    rules:
      - operations: [ "CREATE", "UPDATE", "DELETE" ]
        apiGroups: ["sriovnetwork.openshift.io"]
        apiVersions: ["v1"]
        resources: ["sriovnetworknodepolicies"]
