---
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: katib.kubeflow.org
webhooks:
  - name: validator.experiment.katib.kubeflow.org
    sideEffects: None
    admissionReviewVersions:
      - v1
    clientConfig:
      service:
        name: katib-controller
        namespace: kubeflow
        path: /validate-experiment
    rules:
      - apiGroups:
          - kubeflow.org
        apiVersions:
          - v1beta1
        operations:
          - CREATE
          - UPDATE
        resources:
          - experiments
---
apiVersion: admissionregistration.k8s.io/v1
kind: MutatingWebhookConfiguration
metadata:
  name: katib.kubeflow.org
webhooks:
  - name: defaulter.experiment.katib.kubeflow.org
    sideEffects: None
    admissionReviewVersions:
      - v1
    clientConfig:
      service:
        name: katib-controller
        namespace: kubeflow
        path: /mutate-experiment
    rules:
      - apiGroups:
          - kubeflow.org
        apiVersions:
          - v1beta1
        operations:
          - CREATE
          - UPDATE
        resources:
          - experiments
  - name: mutator.pod.katib.kubeflow.org
    sideEffects: None
    admissionReviewVersions:
      - v1
    clientConfig:
      service:
        name: katib-controller
        namespace: kubeflow
        path: /mutate-pod
    namespaceSelector:
      matchLabels:
        katib.kubeflow.org/metrics-collector-injection: enabled
    matchConditions:
      - name: 'exclude-katib-controller'
        expression: 'request.userInfo.username != "system:serviceaccount:kubeflow:katib-controller"'
    rules:
      - apiGroups:
          - ""
        apiVersions:
          - v1
        operations:
          - CREATE
        resources:
          - pods
