﻿apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: workflows.synapse.io
spec:
  scope: Namespaced
  names:
    plural: workflows
    singular: workflow
    kind: Workflow
  group: synapse.io
  versions:
    - name: v1alpha1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          properties:
            spec:
              type: object
              properties:
                definition:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true
              required:
                - definition
            status:
              type: object
              properties:
                type:
                  type: string
                  enum: 
                    - PENDING
                    - PROCESSING
                    - VALID
                    - INVALID
                errors:
                  type: array
                  items:
                    type: object
                    properties:
                      code:
                        type: string
                      message:
                        type: string
                    required:
                      - code
                      - message
          required:
            - spec
      subresources:
        status: {}
      additionalPrinterColumns:
        - name: Id
          type: string
          description: The id of the workflow
          jsonPath: .spec.definition.id
        - name: Name
          type: string
          description: The name of the workflow
          jsonPath: .spec.definition.name
        - name: Description
          type: string
          description: The description of the workflow
          jsonPath: .spec.definition.description
        - name: Version
          type: string
          description: The version of the workflow
          jsonPath: .spec.definition.version
        - name: Status
          type: string
          description: The workflow's status
          jsonPath: .status.type