apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: loadtests.kangal.hellofresh.com
spec:
  group: kangal.hellofresh.com
  scope: Cluster
  names:
    kind: LoadTest
    plural: loadtests
    singular: loadtest
    shortNames:
      - lt
  versions:
    - name: v1
      served: true
      storage: true
      additionalPrinterColumns:
        - name: Type
          type: string
          description: The what kind of loadtest is being ran
          jsonPath: .spec.type
        - name: Phase
          type: string
          description: The current phase of the loadtest
          jsonPath: .status.phase
        - name: Age
          type: date
          jsonPath: .metadata.creationTimestamp
      # subresources describes the subresources for custom resources.
      subresources:
        # status enables the status subresource.
        status: { }
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                type:
                  type: string
                  enum: [ JMeter, Fake ]
                distributedPods:
                  minimum: 1
                  type: integer
                testFile:
                  type: string
                testData:
                  type: string
                envVars:
                  type: string
                masterConfig:
                  type: object
                  properties:
                    image:
                      type: string
                    tag:
                      type: string
                workerConfig:
                  type: object
                  properties:
                    image:
                      type: string
                    tag:
                      type: string
              required: [ "distributedPods", "testFile", "type" ]
            status:
              type: object
              properties:
                phase:
                  type: string
                  nullable: false
                  enum: [ creating, starting, running, finished, errored ]
                namespace:
                  type: string
                jobStatus:
                  type: object
