---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.16.4
  name: keyspaces.serverless.pingcap.com
spec:
  group: serverless.pingcap.com
  names:
    kind: Keyspace
    listKind: KeyspaceList
    plural: keyspaces
    singular: keyspace
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .status.phase
      name: PHASE
      type: string
    - jsonPath: .spec.keyspaceName
      name: KEYSPACE NAME
      type: string
    - jsonPath: .status.keyspaceId
      name: KEYSPACE ID
      type: string
    - jsonPath: .spec.encrypt
      name: ENCRYPT
      type: boolean
    - jsonPath: .status.inPool
      name: INPOOL
      type: boolean
    - jsonPath: .status.bindCluster
      name: BIND CLUSTER
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: AGE
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: Keyspace is the Schema for the keyspaces 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: KeyspaceSpec defines the desired state of Keyspace
            properties:
              encrypt:
                default: false
                type: boolean
                x-kubernetes-validations:
                - message: encrypt is immutable
                  rule: self == oldSelf
              keyspaceName:
                type: string
                x-kubernetes-validations:
                - message: keyspaceName is immutable
                  rule: self == oldSelf
            required:
            - keyspaceName
            type: object
          status:
            default:
              inPool: true
              phase: Pending
            description: |-
              KeyspaceStatus defines the observed state of Keyspace.
              It should always be reconstructable from the state of the cluster and/or outside world.
            properties:
              bindCRType:
                default: Cluster
                enum:
                - Cluster
                - Branch
                type: string
              bindCluster:
                type: string
                x-kubernetes-validations:
                - message: bindCluster is immutable
                  rule: self == oldSelf
              clusterNs:
                type: string
                x-kubernetes-validations:
                - message: clusterNs is immutable
                  rule: self == oldSelf
              inPool:
                default: true
                type: boolean
              keyspaceId:
                format: int32
                type: integer
                x-kubernetes-validations:
                - message: keyspaceId is immutable
                  rule: self == oldSelf
              phase:
                default: Pending
                enum:
                - Pending
                - Creating
                - Activating
                - Available
                - Binding
                - Bind
                type: string
            required:
            - inPool
            type: object
            x-kubernetes-validations:
            - message: bindCluster is required once set
              rule: '!has(oldSelf.bindCluster) || has(self.bindCluster)'
            - message: clusterNs is required once set
              rule: '!has(oldSelf.clusterNs) || has(self.clusterNs)'
            - message: keyspaceId is required once set
              rule: '!has(oldSelf.keyspaceId) || has(self.keyspaceId)'
        required:
        - spec
        type: object
    served: true
    storage: true
    subresources:
      status: {}
