#
# Copyright 2021 Datatrucker.io Inc , Ontario , Canada
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: datatruckerflows.datatrucker.datatrucker.io
spec:
  group: datatrucker.datatrucker.io
  names:
    kind: DatatruckerFlow
    listKind: DatatruckerFlowList
    plural: datatruckerflows
    singular: datatruckerflow
    shortNames:
    - flows
    categories:
    - all
  scope: Namespaced
  versions:
  - name: v1
    additionalPrinterColumns:
    - name: Type
      type: string
      description: The Type of API Flow
      jsonPath: .spec.Type
    - name: Replicas
      type: integer
      description: The number of jobs launched by the CronJob
      jsonPath: .spec.Replicas
    - name: Age
      type: date
      jsonPath: .metadata.creationTimestamp
    - name: DatatruckerConfig
      type: string
      description: Mapped Config
      jsonPath: .spec.DatatruckerConfig
      
    schema:
      openAPIV3Schema:
        description: DatatruckerFlow is the Schema for the datatruckerflows API
        properties:
          apiVersion:
            description: 'APIVersion defines the versioned schema of this representation
              of an object. Servers should convert recognized schemas to the latest
              internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
            type: string
          kind:
            description: 'Kind is a string value representing the REST resource this
              object represents. Servers may infer this from the endpoint the client
              submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            description: Spec defines the desired state of DatatruckerFlow
            type: object
            x-kubernetes-preserve-unknown-fields: true
            required: ["DatatruckerConfig"]
            properties:

 
              Type:
                type: string         
              DatatruckerConfig:
                type: string         
              Replicas:
                type: integer    

              Scripts:
                type: object
                properties:
                  configmap:
                    type: string

              Keys:
                type: object
                properties:
                  configmap:
                    type: string

              Resources:
                type: object
                properties:
                  requests:
                    type: object 
                    properties:
                      memory:  
                        type: string 
                      cpu:  
                        type: string 
                  limits:
                    type: object 
                    properties:
                      memory:  
                        type: string 
                      cpu:  
                        type: string 

              API:
                type: object
                properties:
                  name: 
                    type: string
                  Image:
                    type: object 
                    properties:
                      repository:  
                        type: string 
                      imageName:  
                        type: string 
                      tagName:  
                        type: string 
                      imageNameUI:  
                        type: string 
              
              JobDefinitions:
                type: array
                items:
                  type: object
                  x-kubernetes-preserve-unknown-fields: true





          status:
            description: Status defines the observed state of DatatruckerFlow
            type: object
            x-kubernetes-preserve-unknown-fields: true
        type: object
    served: true
    storage: true
    subresources:
      status: {}
