---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: {{.SRIOVMutatingWebhookName}}
  annotations:
    {{- if eq .ClusterType "openshift" }}
    service.beta.openshift.io/inject-cabundle: "true"
    {{- else if and (not .CaBundle) (eq .ClusterType "kubernetes") }}
    cert-manager.io/inject-ca-from: {{.Namespace}}/network-resources-injector-secret
    {{- end }}
webhooks:
  - name: network-resources-injector-config.k8s.io
    sideEffects: None
    admissionReviewVersions: [v1]
    failurePolicy: Ignore
    clientConfig:
      service:
        name: network-resources-injector-service
        namespace: {{.Namespace}}
        path: "/mutate"
      {{- if and (.CaBundle) (eq .ClusterType "kubernetes") }}
      caBundle: "{{.CaBundle}}"
      {{- end }}
    rules:
      - operations: [ "CREATE" ]
        apiGroups: ["apps", ""]
        apiVersions: ["v1"]
        resources: ["pods"]
