---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.16.1
  name: pdgroups.core.pingcap.com
spec:
  group: core.pingcap.com
  names:
    categories:
    - tg
    kind: PDGroup
    listKind: PDGroupList
    plural: pdgroups
    singular: pdgroup
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.cluster.name
      name: Cluster
      type: string
    - jsonPath: .status.conditions[?(@.type=="Available")].status
      name: Available
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: Age
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: PDGroup defines a group of similar PD instances
        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: PDGroupSpec describes the common attributes of a PDGroup
            properties:
              bootstrapped:
                description: |-
                  Bootstrapped means that pd cluster has been bootstrapped
                  It's no need to initialize a new cluster
                  Normally, this field is automatically changed by operator.
                  If it's true, it cannot be set to false for security
                type: boolean
              cluster:
                properties:
                  name:
                    type: string
                required:
                - name
                type: object
              replicas:
                format: int32
                type: integer
              schedulePolicies:
                items:
                  description: SchedulePolicy defines how instances of the group schedules
                    its pod.
                  properties:
                    evenlySpread:
                      properties:
                        topologies:
                          description: All instances of a group will evenly spread
                            in differnet topologies
                          items:
                            properties:
                              topology:
                                additionalProperties:
                                  type: string
                                description: Topology means the topo for scheduling
                                type: object
                              weight:
                                description: |-
                                  Weight defines how many pods will be scheduled to this topo
                                  default is 1
                                format: int32
                                type: integer
                            required:
                            - topology
                            type: object
                          type: array
                      required:
                      - topologies
                      type: object
                    type:
                      type: string
                  required:
                  - type
                  type: object
                type: array
              template:
                properties:
                  metadata:
                    description: |-
                      ObjectMeta is defined for replacing the embedded metav1.ObjectMeta
                      Now only labels and annotations are allowed
                    properties:
                      annotations:
                        additionalProperties:
                          type: string
                        description: |-
                          Annotations is an unstructured key value map stored with a resource that may be
                          set by external tools to store and retrieve arbitrary metadata. They are not
                          queryable and should be preserved when modifying objects.
                          More info: http://kubernetes.io/docs/user-guide/annotations
                        type: object
                      labels:
                        additionalProperties:
                          type: string
                        description: |-
                          Map of string keys and values that can be used to organize and categorize
                          (scope and select) objects. May match selectors of replication controllers
                          and services.
                          More info: http://kubernetes.io/docs/user-guide/labels
                        type: object
                      name:
                        description: |-
                          Name must be unique within a namespace. Is required when creating resources, although
                          some resources may allow a client to request the generation of an appropriate name
                          automatically. Name is primarily intended for creation idempotence and configuration
                          definition.
                          Cannot be updated.
                          More info: http://kubernetes.io/docs/user-guide/identifiers#names
                        type: string
                    type: object
                  spec:
                    description: PDTemplateSpec can only be specified in PDGroup
                    properties:
                      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
                      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
                      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:
                    - config
                    - volumes
                    type: object
                required:
                - spec
                type: object
              version:
                type: string
            required:
            - cluster
            - replicas
            - template
            - version
            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
              currentReplicas:
                description: |-
                  CurrentReplicas is the number of Instances created by the Group controller from the Group version
                  indicated by currentRevision.
                format: int32
                type: integer
              currentRevision:
                description: CurrentRevision is the revision of the Controller that
                  created the resource.
                type: string
              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
              readyReplicas:
                description: ReadyReplicas is the number of Instances created for
                  this ComponentGroup with a Ready Condition.
                format: int32
                type: integer
              replicas:
                description: Replicas is the number of Instance created by the controller.
                format: int32
                type: integer
              updateRevision:
                description: UpdateRevision is the revision of the Controller that
                  should modify the resource.
                type: string
              updatedReplicas:
                description: |-
                  UpdatedReplicas is the number of Instances created by the Group controller from the Group version
                  indicated by updateRevision.
                format: int32
                type: integer
              version:
                description: |-
                  Version is the version of all instances in the group.
                  It will be same as the `spec.version` only when all instances are upgraded to the desired version.
                type: string
            required:
            - replicas
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
