apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: decisions.operator.baaas
spec:
  group: operator.baaas
  names:
    kind: Decision
    listKind: DecisionList
    plural: decisions
    singular: decision
    categories:
      - all
      - baaas
  scope: Namespaced
  versions:
    - name: v1alpha1
      served: true
      storage: true
      subresources:
        status: {}
      additionalPrinterColumns:
        - name: Version
          type: string
          description: Current decision revision
          jsonPath: .status.versionId
        - name: Endpoint
          type: string
          description: Decision endpoint
          jsonPath: .status.endpoint
      schema:
        openAPIV3Schema:
          type: object
          properties:
            status:
              type: object
              properties:
                endpoint:
                  type: string
                versionId:
                  type: string
            spec:
              type: object
              required:
                - definition
              properties:
                definition:
                  type: object
                  required:
                    - version
                    - source
                  properties:
                    version:
                      type: string
                    source:
                      type: string
                    kafka:
                      type: object
                      required:
                        - bootstrapServers
                        - secretName
                        - inputTopic
                        - outputTopic
                      properties:
                        bootstrapServers:
                          type: string
                        secretName:
                          type: string
                        inputTopic:
                          type: string
                        outputTopic:
                          type: string
                    env:
                      type: object
                webhooks:
                  type: array
                  items:
                    type: string