apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: espservers.iot.sas.com
spec:
  group: iot.sas.com
  names:
    kind: ESPServer
    listKind: ESPServerList
    plural: espservers
    singular: espserver
  scope: Namespaced
  versions:
  - name: v1alpha1
    # Each version can be enabled/disabled by Served flag.
    served: true
    # One and only one version must be marked as the storage version.
    storage: true
    schema:
      openAPIV3Schema:
        properties:
          access:
            properties:
              externalURL:
                type: string
              internalHostName:
                type: string
              internalHttpPort:
                format: int64
                type: integer
              state:
                description: 'INSERT ADDITIONAL STATUS FIELD - define observed state
                  of cluster Important: Run "operator-sdk generate k8s" to regenerate
                  code after modifying this file Add custom validation using kubebuilder
                  tags: https://book.kubebuilder.io/beyond_basics/generating_crd.html'
                type: string
            type: object
          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/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/api-conventions.md#types-kinds'
            type: string
          metadata:
            type: object
          spec:
            properties:
              espProperties:
                nullable: true
                additionalProperties:
                  type: string
                type: object
              failover:
                type: boolean
              loadBalancePolicy:
                type: string
              projectTemplate:
                nullable: true
                type: object
                properties:
                  autoscale:
                    properties:
                      maxReplicas:
                        format: int32
                        type: integer
                      metrics:
                        items:
                          type: object
                        type: array
                      minReplicas:
                        format: int32
                        type: integer
                    required:
                    - minReplicas
                    - maxReplicas
                    - metrics
                    type: object
                  spec:
                    nullable: true
                    type: object
                    properties:
                      replicas:
                        description: number of replicas
                        format: int64
                        type: integer
              loadBalancerTemplate:
                nullable: true
                type: object
                properties:
                  spec:
                    nullable: true
                    type: object
                    properties:
                      replicas:
                        description: number of replicas
                        format: int64
                        type: integer     
            required:
            - espProperties
            - loadBalancePolicy
            type: object

