apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: workshopenvironments.training.eduk8s.io
spec:
  scope: Cluster
  group: training.eduk8s.io
  names:
    plural: workshopenvironments
    singular: workshopenvironment
    kind: WorkshopEnvironment
    categories:
    - eduk8s
    - eduk8s-training
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              required:
              - workshop
              properties:
                system:
                  type: object
                  properties:
                    profile:
                      type: string
                workshop:
                  type: object
                  required:
                  - name
                  properties:
                    name:
                      type: string
                request:
                  type: object
                  required:
                  - enabled
                  properties:
                    enabled:
                      type: boolean
                    token:
                      type: string
                    namespaces:
                      type: array
                      items:
                        type: string
                session:
                  type: object
                  properties:
                    username:
                      type: string
                    password:
                      type: string
                    ingress:
                      type: object
                      properties:
                        domain:
                          type: string
                        protocol:
                          type: string
                        secret:
                          type: string
                        class:
                          type: string
                    env:
                      type: array
                      items:
                        type: object
                        required:
                        - name
                        properties:
                          name:
                            type: string
                          value:
                            type: string
                environment:
                  type: object
                  properties:
                    objects:
                      type: array
                      items:
                        type: object
                        x-kubernetes-preserve-unknown-fields: true
                analytics:
                  type: object
                  properties:
                    google:
                      type: object
                      properties:
                        trackingId:
                          type: string
            status:
              type: object
              x-kubernetes-preserve-unknown-fields: true
              properties:
                eduk8s:
                  type: object
                  required:
                  - namespace
                  - secrets
                  - workshop
                  properties:
                    namespace:
                      type: string
                    secrets:
                      type: object
                      properties:
                        ingress:
                          type: array
                          items:
                            type: string
                        registry:
                          type: array
                          items:
                            type: string
                    workshop:
                      type: object
                      required:
                      - name
                      - uid
                      - generation
                      - spec
                      properties:
                        name:
                          type: string
                        uid:
                          type: string
                        generation:
                          type: integer
                        spec:
                          type: object
                          x-kubernetes-preserve-unknown-fields: true
      additionalPrinterColumns:
      - name: Namespace
        type: string
        priority: 0
        description: The namespace in which the workshop is deployed.
        jsonPath: .status.eduk8s.namespace
      - name: Workshop
        type: string
        priority: 0
        description: The name of the workshop definition.
        jsonPath: .status.eduk8s.workshop.name
      - name: Image
        type: string
        priority: 0
        description: The image used to deploy the workshop.
        jsonPath: .status.eduk8s.workshop.spec.image
      - name: URL
        type: string
        priority: 0
        description: URL for further information on the workshop.
        jsonPath: .status.eduk8s.workshop.spec.url
