---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: training-operator-v2
  labels:
    app.kubernetes.io/name: training
    app.kubernetes.io/component: manager
    app.kubernetes.io/part-of: kubeflow
spec:
  selector:
    matchLabels:
      app.kubernetes.io/name: training
      app.kubernetes.io/component: manager
      app.kubernetes.io/part-of: kubeflow
  template:
    metadata:
      labels:
        app.kubernetes.io/name: training
        app.kubernetes.io/component: manager
        app.kubernetes.io/part-of: kubeflow
    spec:
      containers:
        - name: manager
          image: kubeflow/training-operator-v2
          env:
            - name: MY_POD_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          volumeMounts:
            - mountPath: /tmp/k8s-webhook-server/serving-certs
              name: cert
              readOnly: true
          livenessProbe:
            httpGet:
              path: /healthz
              port: 8081
            initialDelaySeconds: 15
            periodSeconds: 20
            timeoutSeconds: 3
          readinessProbe:
            httpGet:
              path: /readyz
              port: 8081
            initialDelaySeconds: 10
            periodSeconds: 15
            timeoutSeconds: 3
      serviceAccountName: training-operator-v2
      volumes:
        - name: cert
          secret:
            defaultMode: 420
            secretName: training-operator-v2-webhook-cert
---
apiVersion: v1
kind: Service
metadata:
  name: training-operator-v2
spec:
  ports:
    - name: monitoring-port
      port: 8080
      targetPort: 8080
    - name: webhook-server
      port: 443
      protocol: TCP
      targetPort: 9443
  selector:
    app.kubernetes.io/component: manager
