---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.19.0
  name: loadbalancers.dedicated.regionalserver.tidbcloud.com
spec:
  group: dedicated.regionalserver.tidbcloud.com
  names:
    categories:
    - regionserver
    kind: LoadBalancer
    listKind: LoadBalancerList
    plural: loadbalancers
    singular: loadbalancer
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .status.phase
      name: PHASE
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: AGE
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: LoadBalancer is the Schema for the loadbalancer 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: LoadBalancerSpec defines the desired state of LoadBalancer
            properties:
              annotations:
                additionalProperties:
                  type: string
                description: |-
                  Annotations are merged onto the generated K8s Service annotations
                  after the controller's provider-specific defaults. Caller values win
                  on key collision, which lets callers set provider-specific tuning
                  knobs (e.g. aws-load-balancer-target-group-attributes,
                  aws-load-balancer-healthcheck-path) without typed API fields.
                type: object
              dataPlane:
                properties:
                  name:
                    type: string
                  namespace:
                    type: string
                required:
                - name
                - namespace
                type: object
              gracefulUnhealthyEnabled:
                description: |-
                  GracefulUnhealthyEnabled is a transitional TiProxy legacy graceful rollout switch.
                  When enabled, dataplane-manager applies provider-specific best-effort behavior
                  so unhealthy old TiProxy backends can keep serving existing connections while
                  new connections are steered away as much as the provider allows.
                type: boolean
              identity:
                type: string
              ipWhiteList:
                items:
                  type: string
                type: array
              namespace:
                type: string
              ownership:
                description: |-
                  ResourceOwnership identifies the SharedPool that owns a DPM resource.
                  The parent DataPlane association remains on the owning resource.
                properties:
                  sharedPoolID:
                    minLength: 1
                    type: string
                required:
                - sharedPoolID
                type: object
              port:
                description: |-
                  Deprecated: prefer Ports for multi-port LBs. Kept for backward
                  compatibility with existing (single-port) CRs such as tiproxy and
                  per-TiDBGroup private/public LBs.
                format: int32
                type: integer
              ports:
                description: |-
                  Ports overrides Port when non-empty. Each entry produces one listener
                  on the cloud LB and one Kubernetes ServicePort.
                items:
                  description: LoadBalancerPort defines a single LB listener.
                  properties:
                    name:
                      description: Name is the K8s ServicePort name, e.g. "cassandra",
                        "cassandra-ssl".
                      type: string
                    port:
                      description: Port is the LB listener port.
                      format: int32
                      type: integer
                    protocol:
                      description: Protocol is "TCP" / "UDP" / "TLS". Empty string
                        defaults to TCP.
                      type: string
                    targetPort:
                      description: TargetPort is the pod-facing port. Defaults to
                        Port when zero.
                      format: int32
                      type: integer
                  required:
                  - name
                  - port
                  type: object
                type: array
              preserveClientIP:
                description: |-
                  PreserveClientIP controls whether the generated load balancer keeps
                  the original client IP. When unset, providers default PRIVATE to
                  false and PUBLIC to true. Currently only supported by AWS and
                  AliCloud load balancers.
                type: boolean
              selectors:
                additionalProperties:
                  type: string
                type: object
              subIdentity:
                type: string
              tags:
                additionalProperties:
                  type: string
                type: object
              type:
                type: string
            required:
            - identity
            - namespace
            - selectors
            - type
            type: object
            x-kubernetes-validations:
            - message: ownership is immutable
              rule: has(self.ownership) == has(oldSelf.ownership) && (!has(self.ownership)
                || self.ownership == oldSelf.ownership)
          status:
            description: LoadBalancerStatus defines the observed state of LoadBalancer
            properties:
              cloudResourceId:
                type: string
              dns:
                type: string
              phase:
                type: string
              privateIPs:
                items:
                  type: string
                type: array
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
