apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: topolvm-hook
  annotations:
    cert-manager.io/inject-ca-from: topolvm-system/mutatingwebhook
  labels:
    app.kubernetes.io/name: topolvm-hook
webhooks:
  - name: pod-hook.topolvm.cybozu.com
    admissionReviewVersions:
      - "v1"
      - "v1beta1"
    namespaceSelector:
      matchExpressions:
      - key: topolvm.cybozu.com/webhook
        operator: NotIn
        values: ["ignore"]
    failurePolicy: Fail
    clientConfig:
      service:
        namespace: topolvm-system
        name: controller
        path: /pod/mutate
    rules:
      - operations: ["CREATE"]
        apiGroups: [""]
        apiVersions: ["v1"]
        resources: ["pods"]
    sideEffects: None
  - name: pvc-hook.topolvm.cybozu.com
    admissionReviewVersions:
      - "v1"
      - "v1beta1"
    namespaceSelector:
      matchExpressions:
      - key: topolvm.cybozu.com/webhook
        operator: NotIn
        values: ["ignore"]
    failurePolicy: Fail
    clientConfig:
      service:
        namespace: topolvm-system
        name: controller
        path: /pvc/mutate
    rules:
      - operations: ["CREATE"]
        apiGroups: [""]
        apiVersions: ["v1"]
        resources: ["persistentvolumeclaims"]
    sideEffects: None
