---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.17.2
  name: upgradeoperations.dedicated.regionalserver.tidbcloud.com
spec:
  group: dedicated.regionalserver.tidbcloud.com
  names:
    kind: UpgradeOperation
    listKind: UpgradeOperationList
    plural: upgradeoperations
    shortNames:
    - ruo
    singular: upgradeoperation
  scope: Namespaced
  versions:
  - additionalPrinterColumns:
    - jsonPath: .spec.appBoxName
      name: AppBoxName
      type: string
    - jsonPath: .spec.schedule
      name: Schedule
      type: string
    - jsonPath: .spec.paused
      name: Paused
      type: boolean
    - jsonPath: .status.phase
      name: Phase
      type: string
    - jsonPath: .metadata.creationTimestamp
      name: AGE
      type: date
    name: v1alpha1
    schema:
      openAPIV3Schema:
        description: UpgradeOperation is the Schema for the upgradeoperations 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: UpgradeOperationSpec defines the desired state of UpgradeOperation
            properties:
              appBoxName:
                description: AppBoxName is the name of the AppBox CR.
                type: string
              duration:
                default: 2h
                description: |-
                  Duration is the desired duration of the upgrade operation, it's used for alerting.
                  If unset, this defaults to 2 hours.
                  Value must be in units accepted by Go time.ParseDuration https://golang.org/pkg/time/#ParseDuration.
                type: string
              paused:
                default: false
                description: Paused indicates if the upgrade operation is paused.
                type: boolean
              schedule:
                description: |-
                  Schedule specifies when the upgrade should be performed.
                  The UpgradeOperationScheduleLayout should be `2006-01-02 15:04:05 -0700 MST`.
                type: string
              steps:
                description: Steps is a list of upgrade steps to be performed.
                items:
                  description: Step defines a single upgrade step, i.e. upgrade <Target>
                    to <Version> for <Cluster>.
                  properties:
                    beginTime:
                      format: date-time
                      type: string
                    cluster:
                      type: string
                    duration:
                      type: string
                    endTime:
                      format: date-time
                      type: string
                    lastProgressTime:
                      description: LastProgressTime is the step-level high-water mark
                        for stuck detection.
                      format: date-time
                      type: string
                    options:
                      additionalProperties:
                        type: string
                      description: |-
                        Options is a set of key-value pairs that can be used to specify additional options.

                        The following options are supported:
                          - "migrate-managed-nodegroup": if set to "true", will migrate managed node groups to self-managed node groups.
                          - "scale-out-extra-tidb": if set to "true", an extra TiDB instance will be scaled out when upgrading.
                          - "delay": specifies a delay duration before executing this step, e.g., "10m" for 10 minutes.
                      type: object
                    phases:
                      description: Phases records fine-grained sub-phase history within
                        this step.
                      items:
                        description: StepPhase records one visit to a fine-grained
                          sub-phase within a step.
                        properties:
                          beginTime:
                            format: date-time
                            type: string
                          done:
                            type: integer
                          endTime:
                            format: date-time
                            type: string
                          lastProgressTime:
                            format: date-time
                            type: string
                          maxDone:
                            type: integer
                          name:
                            type: string
                          progressInfo:
                            type: string
                          total:
                            type: integer
                        type: object
                      type: array
                    target:
                      type: string
                    version:
                      type: string
                  required:
                  - target
                  - version
                  type: object
                type: array
              ttl:
                default: 8760h
                description: |-
                  TTL is the time to live for Completed/Failed UpgradeOperation CRs.
                  Value must be in units accepted by Go time.ParseDuration https://golang.org/pkg/time/#ParseDuration.
                  If unset, this defaults to 8760 hours (1 year).
                type: string
            required:
            - appBoxName
            - schedule
            - steps
            type: object
          status:
            description: UpgradeOperationStatus defines the observed state of UpgradeOperation
            properties:
              beginTime:
                format: date-time
                type: string
              currentStep:
                description: Step defines a single upgrade step, i.e. upgrade <Target>
                  to <Version> for <Cluster>.
                properties:
                  beginTime:
                    format: date-time
                    type: string
                  cluster:
                    type: string
                  duration:
                    type: string
                  endTime:
                    format: date-time
                    type: string
                  lastProgressTime:
                    description: LastProgressTime is the step-level high-water mark
                      for stuck detection.
                    format: date-time
                    type: string
                  options:
                    additionalProperties:
                      type: string
                    description: |-
                      Options is a set of key-value pairs that can be used to specify additional options.

                      The following options are supported:
                        - "migrate-managed-nodegroup": if set to "true", will migrate managed node groups to self-managed node groups.
                        - "scale-out-extra-tidb": if set to "true", an extra TiDB instance will be scaled out when upgrading.
                        - "delay": specifies a delay duration before executing this step, e.g., "10m" for 10 minutes.
                    type: object
                  phases:
                    description: Phases records fine-grained sub-phase history within
                      this step.
                    items:
                      description: StepPhase records one visit to a fine-grained sub-phase
                        within a step.
                      properties:
                        beginTime:
                          format: date-time
                          type: string
                        done:
                          type: integer
                        endTime:
                          format: date-time
                          type: string
                        lastProgressTime:
                          format: date-time
                          type: string
                        maxDone:
                          type: integer
                        name:
                          type: string
                        progressInfo:
                          type: string
                        total:
                          type: integer
                      type: object
                    type: array
                  target:
                    type: string
                  version:
                    type: string
                required:
                - target
                - version
                type: object
              duration:
                type: string
              endTime:
                format: date-time
                type: string
              finishedSteps:
                description: Steps is a FIFO queue of upgrade steps.
                items:
                  description: Step defines a single upgrade step, i.e. upgrade <Target>
                    to <Version> for <Cluster>.
                  properties:
                    beginTime:
                      format: date-time
                      type: string
                    cluster:
                      type: string
                    duration:
                      type: string
                    endTime:
                      format: date-time
                      type: string
                    lastProgressTime:
                      description: LastProgressTime is the step-level high-water mark
                        for stuck detection.
                      format: date-time
                      type: string
                    options:
                      additionalProperties:
                        type: string
                      description: |-
                        Options is a set of key-value pairs that can be used to specify additional options.

                        The following options are supported:
                          - "migrate-managed-nodegroup": if set to "true", will migrate managed node groups to self-managed node groups.
                          - "scale-out-extra-tidb": if set to "true", an extra TiDB instance will be scaled out when upgrading.
                          - "delay": specifies a delay duration before executing this step, e.g., "10m" for 10 minutes.
                      type: object
                    phases:
                      description: Phases records fine-grained sub-phase history within
                        this step.
                      items:
                        description: StepPhase records one visit to a fine-grained
                          sub-phase within a step.
                        properties:
                          beginTime:
                            format: date-time
                            type: string
                          done:
                            type: integer
                          endTime:
                            format: date-time
                            type: string
                          lastProgressTime:
                            format: date-time
                            type: string
                          maxDone:
                            type: integer
                          name:
                            type: string
                          progressInfo:
                            type: string
                          total:
                            type: integer
                        type: object
                      type: array
                    target:
                      type: string
                    version:
                      type: string
                  required:
                  - target
                  - version
                  type: object
                type: array
              nextSteps:
                description: Steps is a FIFO queue of upgrade steps.
                items:
                  description: Step defines a single upgrade step, i.e. upgrade <Target>
                    to <Version> for <Cluster>.
                  properties:
                    beginTime:
                      format: date-time
                      type: string
                    cluster:
                      type: string
                    duration:
                      type: string
                    endTime:
                      format: date-time
                      type: string
                    lastProgressTime:
                      description: LastProgressTime is the step-level high-water mark
                        for stuck detection.
                      format: date-time
                      type: string
                    options:
                      additionalProperties:
                        type: string
                      description: |-
                        Options is a set of key-value pairs that can be used to specify additional options.

                        The following options are supported:
                          - "migrate-managed-nodegroup": if set to "true", will migrate managed node groups to self-managed node groups.
                          - "scale-out-extra-tidb": if set to "true", an extra TiDB instance will be scaled out when upgrading.
                          - "delay": specifies a delay duration before executing this step, e.g., "10m" for 10 minutes.
                      type: object
                    phases:
                      description: Phases records fine-grained sub-phase history within
                        this step.
                      items:
                        description: StepPhase records one visit to a fine-grained
                          sub-phase within a step.
                        properties:
                          beginTime:
                            format: date-time
                            type: string
                          done:
                            type: integer
                          endTime:
                            format: date-time
                            type: string
                          lastProgressTime:
                            format: date-time
                            type: string
                          maxDone:
                            type: integer
                          name:
                            type: string
                          progressInfo:
                            type: string
                          total:
                            type: integer
                        type: object
                      type: array
                    target:
                      type: string
                    version:
                      type: string
                  required:
                  - target
                  - version
                  type: object
                type: array
              phase:
                description: Phase describes the current phase of the upgrade operation.
                type: string
              reason:
                description: Reason describes the reason for the current phase.
                type: string
            type: object
        type: object
    served: true
    storage: true
    subresources:
      status: {}
