apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: instances.nplus.cloud
spec:
  group: nplus.cloud
  scope: Namespaced
  names:
    kind: Instance
    singular: instance
    plural: instances
    categories:
    - nplus
    - nscale
  versions:
  - name: v1beta1
    served: true
    storage: true
    additionalPrinterColumns:
      - name: Handler
        type: string
        jsonPath: .spec.handler
      - name: Version
        type: string
        jsonPath: .spec.nscaleVersion
      - name: Tenant
        type: string
        jsonPath: .spec.tenant
      - name: Provider
        type: string
        jsonPath: .spec.provider
        priority: 1
      - name: Status
        type: string
        jsonPath: .status.message
      - name: Components
        type: string
        jsonPath: .spec.components
        priority: 2
    schema:
      openAPIV3Schema:
        type: object
        properties:
          spec:
            type: object
            # x-kubernetes-preserve-unknown-fields: true
            properties:
              nscaleVersion:
                type: string
              components:
                type: string
              handler:
                type: string
              tenant:
                type: string
              provider:
                type: string
              url:
                type: string
              expected:
                type: array
                items:
                  type: object
                  properties:
                    component:
                      type: string
                    replicaCount:
                      type: integer
                  required:
                  - component
                  - replicaCount
          status:
            type: object
            properties:
              usage:
                type: object
                properties:
                  volume:
                    type: integer
                  accounts:
                    type: integer
                  documents:
                    type: integer
              message:
                description: Health human readable
                type: string
              id:
                description: Health status id
                type: integer
              updateTimestamp:
                description: Timestamp of last Health Change
                type: string
