---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.16.1
  name: pds.core.pingcap.com
spec:
  group: core.pingcap.com
  names:
    categories:
    - peer
    kind: PD
    listKind: PDList
    plural: pds
    singular: pd
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.cluster.name
      name: Cluster
      type: string
    - jsonPath: .status.isLeader
      name: Leader
      type: string
    - jsonPath: .status.conditions[?(@.type=="Initialized")].status
      name: Initialized
      type: string
    - jsonPath: .status.conditions[?(@.type=="Health")].status
      name: Healthy
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: PD defines a PD instance
        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: PDSpec describes the common attributes of a PD instance
            properties:
              cluster:
                description: Cluster is a reference of tidb cluster
                properties:
                  name:
                    type: string
                required:
                - name
                type: object
              config:
                description: Config defines config file of PD
                type: string
              image:
                description: |-
                  Image is pd's image
                  If tag is omitted, version will be used as the image tag.
                  Default is pingcap/pd
                type: string
              overlay:
                description: |-
                  Overlay defines a k8s native resource template patch
                  All resources(pod, pvcs, ...) managed by PD can be overlayed by this field
                x-kubernetes-preserve-unknown-fields: true
              resources:
                description: |-
                  ResourceRequirements describes the compute resource requirements.
                  It's simplified from corev1.ResourceRequirements to fit the most common use cases.
                  This field will be translated to requests=limits for all resources.
                  If users need to specify more advanced resource requirements, just try to use overlay to override it
                properties:
                  cpu:
                    anyOf:
                    - type: integer
                    - type: string
                    pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                    x-kubernetes-int-or-string: true
                  memory:
                    anyOf:
                    - type: integer
                    - type: string
                    pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                    x-kubernetes-int-or-string: true
                type: object
              server:
                description: Server defines server config for PD
                properties:
                  ports:
                    description: Ports defines all ports listened by pd
                    properties:
                      client:
                        description: Client defines port for pd's api service
                        properties:
                          port:
                            format: int32
                            type: integer
                        required:
                        - port
                        type: object
                      peer:
                        description: Peer defines port for peer communication
                        properties:
                          port:
                            format: int32
                            type: integer
                        required:
                        - port
                        type: object
                    type: object
                type: object
              subdomain:
                description: |-
                  Subdomain means the subdomain of the exported pd dns.
                  A same pd cluster will use a same subdomain
                type: string
              topology:
                additionalProperties:
                  type: string
                description: |-
                  Topology defines the topology domain of this pd instance
                  It will be translated into a node affinity config
                  Topology cannot be changed
                type: object
              updateStrategy:
                properties:
                  config:
                    default: Restart
                    description: |-
                      Config determines how the configuration change is applied to the cluster.
                      Valid values are "Restart" (by default) and "HotReload".
                    enum:
                    - Restart
                    - HotReload
                    type: string
                type: object
              version:
                description: Version specifies the PD version
                type: string
              volumes:
                description: Volumes defines persistent volumes of PD
                items:
                  description: |-
                    Volume defines a persistent volume, it will be mounted at a specified root path
                    A volume can be mounted for multiple different usages.
                    For example, a volume can be mounted for both data and raft log.
                  properties:
                    for:
                      description: |-
                        For defines the usage of this volume
                        At least one usage is needed for a new volume
                      items:
                        properties:
                          subPath:
                            description: |-
                              SubPath is the relative path of the volume's mount path.
                              The default value of sub path is determined by the usage type.
                            type: string
                          type:
                            description: |-
                              Type is a usage type of the volume.
                              A volume can be defined for multiple usages.
                            type: string
                        required:
                        - type
                        type: object
                      type: array
                    name:
                      description: |-
                        Name is volume name.
                        If not specified, the PVC name will be "{component}-{podName}"
                      type: string
                    path:
                      description: Path is mount path of this volume
                      type: string
                    storage:
                      anyOf:
                      - type: integer
                      - type: string
                      description: Storage defines the request size of this volume
                      pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                      x-kubernetes-int-or-string: true
                    storageClassName:
                      description: |-
                        StorageClassName means the storage class the volume used.
                        You can modify volumes' attributes by changing the StorageClass
                        when VolumeAttributesClass is not available.
                        Note that only newly created PV will use the new StorageClass.
                      type: string
                    volumeAttributesClassName:
                      description: |-
                        VolumeAttributesClassName means the VolumeAttributesClass the volume used.
                        You can modify volumes' attributes by changing it.
                        This feature is introduced since K8s 1.29 as alpha feature and disabled by default.
                        It's only available when the feature is enabled.
                      type: string
                  required:
                  - for
                  - path
                  - storage
                  type: object
                type: array
            required:
            - cluster
            - config
            - subdomain
            - version
            - volumes
            type: object
          status:
            properties:
              collisionCount:
                description: |-
                  CollisionCount is the count of hash collisions. The controller
                  uses this field as a collision avoidance mechanism when it needs to create the name for the
                  newest ControllerRevision.
                format: int32
                type: integer
              conditions:
                description: Conditions contain details of the current state.
                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
              currentRevision:
                description: CurrentRevision is the revision of the Controller that
                  created the resource.
                type: string
              id:
                description: ID is the member id of this pd instance
                type: string
              isLeader:
                description: |-
                  IsLeader indicates whether this pd is the leader
                  NOTE: it's a snapshot from PD, not always up to date
                type: boolean
              observedGeneration:
                description: |-
                  ObservedGeneration is the most recent generation observed by the controller.
                  It's used to determine whether the controller has reconciled the latest spec.
                format: int64
                type: integer
              updateRevision:
                description: UpdateRevision is the revision of the Controller that
                  should modify the resource.
                type: string
            required:
            - id
            - isLeader
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
