apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: mpijobs.kubeflow.org
spec:
  group: kubeflow.org
  scope: Namespaced
  names:
    plural: mpijobs
    singular: mpijob
    kind: MPIJob
    shortNames:
    - mj
    - mpij
  versions:
  - name: v1alpha2
    served: true
    storage: false
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            x-kubernetes-preserve-unknown-fields: true
            type: object
            properties:
              slotsPerWorker:
                type: integer
                minimum: 1
              mpiReplicaSpecs:
                type: object
                properties:
                  Launcher:
                    x-kubernetes-preserve-unknown-fields: true
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                        maximum: 1
                  Worker:
                    x-kubernetes-preserve-unknown-fields: true
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
          status:
            x-kubernetes-preserve-unknown-fields: true
            type: object
    subresources:
      status: {}
  - name: v1
    served: true
    storage: false
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            x-kubernetes-preserve-unknown-fields: true
            type: object
            properties:
              slotsPerWorker:
                type: integer
                minimum: 1
              mpiReplicaSpecs:
                type: object
                properties:
                  Launcher:
                    x-kubernetes-preserve-unknown-fields: true
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                        maximum: 1
                  Worker:
                    x-kubernetes-preserve-unknown-fields: true
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
          status:
            x-kubernetes-preserve-unknown-fields: true
            type: object
    subresources:
      status: {}
  - name: v2beta1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            properties:
              slotsPerWorker:
                type: integer
                minimum: 1
              cleanPodPolicy:
                type: string
                enum: ["None", "Running", "All"]
                description: "Defines which Pods must be deleted after the Job completes"
              sshAuthMountPath:
                type: string
              mpiImplementation:
                type: string
                enum: ["OpenMPI", "Intel"]
              mpiReplicaSpecs:
                type: object
                properties:
                  Launcher:
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                        maximum: 1
                      template:
                        x-kubernetes-preserve-unknown-fields: true
                        type: object
                      restartPolicy:
                        type: string
                        enum: ["Never", "OnFailure", "Always"]
                  Worker:
                    type: object
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                      template:
                        x-kubernetes-preserve-unknown-fields: true
                        type: object
                      restartPolicy:
                        type: string
                        enum: ["Never", "OnFailure", "Always"]
                required:
                - Launcher
          status:
            type: object
            properties:
              conditions:
                type: array
                items:
                  type: object
                  properties:
                    type:
                      type: string
                      enum: ["Created", "Running", "Restarting", "Succeeded", "Failed"]
                    status:
                      type: string
                      enum: ["True", "False", "Unknown"]
                    reason:
                      type: string
                    message:
                      type: string
                    lastUpdateTime:
                      type: string
                      format: date-time
                    lastTransitionTime:
                      type: string
                      format: date-time
              replicaStatuses:
                type: object
                properties:
                  Launcher:
                    type: object
                    properties:
                      active:
                        type: integer
                      succeeded:
                        type: integer
                      failed:
                        type: integer
                  Worker:
                    type: object
                    properties:
                      active:
                        type: integer
                      succeeded:
                        type: integer
                      failed:
                        type: integer
              startTime:
                type: string
                format: date-time
              completionTime:
                type: string
                format: date-time
              lastReconcileTime:
                type: string
                format: date-time
    subresources:
      status: {}
