apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  name: stores.atomix.io
spec:
  group: atomix.io
  scope: Namespaced
  names:
    kind: Store
    listKind: StoreList
    plural: stores
    singular: store
  versions:
  - name: v2beta1
    served: true
    storage: true
    subresources:
      status: {}
    schema:
      openAPIV3Schema:
        type: object
        required:
        - spec
        properties:
          spec:
            description: |-
              The specification for the store. The spec must include a protocol configuration describing how the
              store should be implemented.
            type: object
            properties:
              protocol:
                description: |-
                  The configuration for the protocol to be used to implement the store. The protocol is a complete
                  Kubernetes resource configuration, including the 'apiVersion' and 'kind'. The protocol kind must
                  match a custom resource defined by one of the StoragePlugins.
                type: object
                x-kubernetes-embedded-resource: true
                x-kubernetes-preserve-unknown-fields: true
          status:
            type: object
            properties:
              ready:
                type: boolean
              replicas:
                type: integer
              readyReplicas:
                type: integer
              partitions:
                type: integer
              readyPartitions:
                type: integer
              protocol:
                type: object
                properties:
                  revision:
                    type: integer
                  replicas:
                    type: array
                    items:
                      type: object
                      required:
                      - id
                      - host
                      - port
                      properties:
                        id:
                          type: string
                        nodeId:
                          type: string
                        host:
                          type: string
                        port:
                          type: integer
                        extraPorts:
                          type: object
                          additionalProperties:
                            type: integer
                        ready:
                          type: boolean
                  partitions:
                    type: array
                    items:
                      type: object
                      required:
                      - id
                      - replicas
                      properties:
                        id:
                          type: integer
                          minimum: 1
                        host:
                          type: string
                        port:
                          type: integer
                        replicas:
                          type: array
                          items:
                            type: string
                        readReplicas:
                          type: array
                          items:
                            type: string
                        ready:
                          type: boolean
    additionalPrinterColumns:
    - name: Protocol
      type: string
      description: The storage protocol kind
      jsonPath: .spec.protocol.kind
    - name: Replicas
      type: integer
      description: The number of replicas in the store
      jsonPath: .status.replicas
    - name: Partitions
      type: integer
      description: The number of partitions in the store
      jsonPath: .status.partitions
    - name: Ready
      type: boolean
      description: The store status
      jsonPath: .status.ready