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: v1alpha1
    served: false
    storage: false
    schema:
      openAPIV3Schema:
        properties:
          spec:
            title: The MPIJob spec
            description: Only one of gpus, processingUnits, or replicas should be specified
            oneOf:
            - properties:
                gpus:
                  title: Total number of GPUs
                  description: Valid values are 1, 2, 4, or any multiple of 8
                  oneOf:
                  - type: integer
                    enum:
                    - 1
                    - 2
                    - 4
                  - type: integer
                    multipleOf: 8
                    minimum: 8
                slotsPerWorker:
                  title: The number of slots per worker used in hostfile
                  description: Defaults to the number of processing units per worker
                  type: integer
                  minimum: 1
                gpusPerNode:
                  title: The maximum number of GPUs available per node
                  description: Defaults to the number of GPUs per worker
                  type: integer
                  minimum: 1
              required:
              - gpus
            - properties:
                processingUnits:
                  title: Total number of processing units
                  description: Valid values are 1, 2, 4, or any multiple of 8
                  oneOf:
                  - type: integer
                    enum:
                    - 1
                    - 2
                    - 4
                  - type: integer
                    multipleOf: 8
                    minimum: 8
                slotsPerWorker:
                  title: The number of slots per worker used in hostfile
                  description: Defaults to the number of processing units per worker
                  type: integer
                  minimum: 1
                processingUnitsPerNode:
                  title: The maximum number of processing units available per node
                  description: Defaults to the number of processing units per worker
                  type: integer
                  minimum: 1
                processingResourceType:
                  title: The processing resource type, e.g. 'nvidia.com/gpu' or 'cpu'
                  description: Defaults to 'nvidia.com/gpu'
                  type: string
                  enum:
                  - nvidia.com/gpu
                  - cpu
              required:
              - processingUnits
            - properties:
                replicas:
                  title: Total number of replicas
                  description: The processing resource limit should be specified for each replica
                  type: integer
                  minimum: 1
                slotsPerWorker:
                  title: The number of slots per worker used in hostfile
                  description: Defaults to the number of processing units per worker
                  type: integer
                  minimum: 1
                processingResourceType:
                  title: The processing resource type, e.g. 'nvidia.com/gpu' or 'cpu'
                  description: Defaults to 'nvidia.com/gpu'
                  type: string
                  enum:
                  - nvidia.com/gpu
                  - cpu
              required:
              - replicas
  - name: v1alpha2
    served: true
    storage: false
    schema:
      openAPIV3Schema:
        properties:
          spec:
            properties:
              slotsPerWorker:
                type: integer
                minimum: 1
              mpiReplicaSpecs:
                properties:
                  Launcher:
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                        maximum: 1
                  Worker:
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
  - name: v1
    served: true
    storage: true
    schema:
      openAPIV3Schema:
        properties:
          spec:
            properties:
              slotsPerWorker:
                type: integer
                minimum: 1
              mpiReplicaSpecs:
                properties:
                  Launcher:
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
                        maximum: 1
                  Worker:
                    properties:
                      replicas:
                        type: integer
                        minimum: 1
