---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  name: nodepools.dedicated.regionalserver.tidbcloud.com
spec:
  group: dedicated.regionalserver.tidbcloud.com
  names:
    categories:
    - regionserver
    kind: NodePool
    listKind: NodePoolList
    plural: nodepools
    singular: nodepool
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.instanceType
      name: INSTANCETYPE
      type: string
    - jsonPath: .spec.kubernetesVersion
      name: K8SVERSION
      type: string
    - jsonPath: .spec.dataPlane.name
      name: DATAPLANE
      type: string
    - jsonPath: .status.phase
      name: PHASE
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: AGE
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: NodePool is the Schema for the NodePools 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:
            properties:
              availableCpuMilliCore:
                format: int32
                type: integer
              availableMemoryMi:
                format: int32
                type: integer
              cpuCore:
                format: int32
                type: integer
              dataPlane:
                properties:
                  name:
                    type: string
                  namespace:
                    type: string
                required:
                - name
                - namespace
                type: object
              instanceType:
                type: string
              kubernetesVersion:
                type: string
              labels:
                additionalProperties:
                  type: string
                type: object
              localDiskSizeGi:
                format: int32
                type: integer
              maxCpuMilli:
                description: MaxCpuMilli is the CPU resource limit in millicores.
                format: int32
                type: integer
              maxMemoryMi:
                description: MaxMemoryMi is the memory resource limit in MiB.
                format: int32
                type: integer
              memoryGi:
                format: int32
                type: integer
              nodeType:
                type: string
              placementGroupEnabled:
                description: |-
                  PlacementGroupEnabled is the durable per-NodePool gate set at
                  NodePool creation and read by the EKS controllers (placementgroup.go,
                  nodegroup.go partition branch) on every reconcile.

                  Source-of-truth chain on the CSNG side (see
                  domain/workflow/action/create_node_instance_group.go):
                    1. Sibling inheritance: if a non-builtin workload NodePool exists
                       in the dataplane, the value is inherited from
                       Spec.PlacementGroupEnabled of the first such sibling.
                    2. SharedPool gate fallback: otherwise, the value is read from
                       SharedPool.Provider.PlacementGroupEnabled, which
                       domain/server/create_sharedpool.go sets from the canonical
                       "AWS + single-AZ?" check at CreateSharedPool time.

                  DPM CreateNodePool honours this wire value with a topology sanity
                  check — when true, the dataplane must be single-AZ EKS; false is
                  always accepted. The field is set once and never re-derived by the
                  controllers, so legacy single-AZ, PG-disabled pools keep their
                  original false record across reconciles.
                type: boolean
              resourceNamePrefix:
                type: string
              taints:
                items:
                  properties:
                    effect:
                      type: string
                    key:
                      type: string
                    value:
                      type: string
                  type: object
                type: array
              withLocalDisk:
                type: boolean
            type: object
          status:
            properties:
              conditions:
                items:
                  description: Condition contains details for one aspect of the current
                    state of this API Resource.
                  properties:
                    lastTransitionTime:
                      description: |-
                        lastTransitionTime is the last time the condition transitioned from one status to another.
                        This should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.
                      format: date-time
                      type: string
                    message:
                      description: |-
                        message is a human readable message indicating details about the transition.
                        This may be an empty string.
                      maxLength: 32768
                      type: string
                    observedGeneration:
                      description: |-
                        observedGeneration represents the .metadata.generation that the condition was set based upon.
                        For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date
                        with respect to the current state of the instance.
                      format: int64
                      minimum: 0
                      type: integer
                    reason:
                      description: |-
                        reason contains a programmatic identifier indicating the reason for the condition's last transition.
                        Producers of specific condition types may define expected values and meanings for this field,
                        and whether the values are considered a guaranteed API.
                        The value should be a CamelCase string.
                        This field may not be empty.
                      maxLength: 1024
                      minLength: 1
                      pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
                      type: string
                    status:
                      description: status of the condition, one of True, False, Unknown.
                      enum:
                      - "True"
                      - "False"
                      - Unknown
                      type: string
                    type:
                      description: type of condition in CamelCase or in foo.example.com/CamelCase.
                      maxLength: 316
                      pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
                      type: string
                  required:
                  - lastTransitionTime
                  - message
                  - reason
                  - status
                  - type
                  type: object
                type: array
              currentReplicas:
                format: int32
                type: integer
              kubernetesName:
                type: string
              nodeRole:
                type: string
              observedGeneration:
                format: int64
                type: integer
              phase:
                type: string
              reason:
                type: string
              zones:
                items:
                  type: string
                type: array
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
