---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
  annotations:
    controller-gen.kubebuilder.io/version: v0.21.0
  name: autoscalers.autoscaling.pingcap.com
spec:
  group: autoscaling.pingcap.com
  names:
    kind: Autoscaler
    listKind: AutoscalerList
    plural: autoscalers
    singular: autoscaler
  scope: Namespaced
  versions:
  - name: v1alpha1
    schema:
      openAPIV3Schema:
        description: Autoscaler is the schema for the autoscaling.pingcap.com/v1alpha1
          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: AutoscalerSpec is the desired autoscaling contract written
              by CSNG.
            properties:
              behavior:
                description: Behavior configures scaling behavior by direction.
                properties:
                  scaleDown:
                    description: ScaleDown is the behavior for scaling down.
                    properties:
                      stabilizationWindowSeconds:
                        description: |-
                          StabilizationWindowSeconds is how long previous recommendations should
                          be considered before scaling.
                        format: int32
                        maximum: 3600
                        minimum: 0
                        type: integer
                    type: object
                  scaleUp:
                    description: ScaleUp is the behavior for scaling up.
                    properties:
                      stabilizationWindowSeconds:
                        description: |-
                          StabilizationWindowSeconds is how long previous recommendations should
                          be considered before scaling.
                        format: int32
                        maximum: 3600
                        minimum: 0
                        type: integer
                    type: object
                type: object
              metrics:
                description: Metrics contains the scaling metrics.
                items:
                  description: MetricSpec configures one scaling metric.
                  properties:
                    resource:
                      description: Resource is the core resource metric source.
                      properties:
                        name:
                          description: Name is the resource name (e.g. cpu, memory).
                          type: string
                        target:
                          description: Target is the desired metric target.
                          properties:
                            averageUtilization:
                              description: AverageUtilization is the target average
                                utilization percentage.
                              format: int32
                              maximum: 100
                              minimum: 1
                              type: integer
                            type:
                              description: Type selects the target value semantics.
                              enum:
                              - Utilization
                              type: string
                          required:
                          - type
                          type: object
                          x-kubernetes-validations:
                          - message: averageUtilization must be set if and only if
                              target.type == 'Utilization'
                            rule: 'self.type == ''Utilization'' ? has(self.averageUtilization)
                              : !has(self.averageUtilization)'
                      required:
                      - name
                      - target
                      type: object
                    type:
                      description: Type discriminates the metric source.
                      enum:
                      - Resource
                      type: string
                  required:
                  - type
                  type: object
                  x-kubernetes-validations:
                  - message: metrics.resource must be set if and only if metrics.type
                      == 'Resource'
                    rule: 'self.type == ''Resource'' ? has(self.resource) : !has(self.resource)'
                minItems: 1
                type: array
              mode:
                description: Mode is AUTO, DRY_RUN or DISABLED.
                enum:
                - AUTO
                - DRY_RUN
                - DISABLED
                type: string
              policy:
                description: Policy is the optional high-level scaling strategy.
                enum:
                - CostOptimized
                type: string
              replicas:
                description: Replicas configures optional horizontal bounds.
                properties:
                  max:
                    description: Max is the upper replica bound.
                    format: int32
                    minimum: 1
                    type: integer
                  min:
                    description: Min is the lower replica bound.
                    format: int32
                    minimum: 0
                    type: integer
                required:
                - max
                - min
                type: object
                x-kubernetes-validations:
                - message: replicas.max must be greater than or equal to replicas.min
                  rule: self.max >= self.min
              targetRef:
                description: TargetRef references the target object (apiVersion/kind/name
                  only).
                properties:
                  apiVersion:
                    description: APIVersion of the referent.
                    minLength: 1
                    type: string
                  kind:
                    description: Kind of the referent.
                    minLength: 1
                    type: string
                  name:
                    description: Name of the referent.
                    minLength: 1
                    type: string
                required:
                - apiVersion
                - kind
                - name
                type: object
              tiers:
                description: Tiers defines legal vertical tiers from low to high.
                properties:
                  sets:
                    description: |-
                      Sets lists independent tier generation sets. Tiers generated from each
                      set are appended in order; sets are not combined with each other.

                      Use multiple sets when the legal tiers cannot be described as a single
                      Cartesian product. Each set must describe the full resource tuple needed
                      by the selected template.
                    items:
                      description: TierSet defines one complete resource combination
                        set.
                      properties:
                        dimensions:
                          description: |-
                            Dimensions are combined by Cartesian product within this set.

                            Each dimension contributes one resource tuple. The final tiers for this
                            set contain every possible combination of one tuple from each dimension.
                            The same resource name must not appear in more than one dimension because
                            the product would otherwise produce conflicting resource values.
                          items:
                            description: TierDimension defines resources whose variants
                              are zipped by index.
                            properties:
                              resources:
                                description: |-
                                  Resources are zipped by variant index. Every resource in one dimension
                                  must produce the same number of variants.

                                  A dimension may contain one resource or multiple resources. Multiple
                                  resources in the same dimension are coupled: variant index 0 from every
                                  resource forms the first tuple, index 1 forms the second tuple, and so on.
                                  This is how cpu and memory can scale together without producing every
                                  possible cpu/memory pair.
                                items:
                                  description: TierDimensionResource defines variants
                                    for one resource.
                                  properties:
                                    name:
                                      description: |-
                                        Name is the resource name used in generated tier resources and template
                                        matcher lookups.
                                      example: cpu
                                      type: string
                                    range:
                                      description: |-
                                        Range generates ordered resource variants from min to max, inclusive. It
                                        is an alternative to Variants; exactly one of Range or Variants must be
                                        set.
                                      properties:
                                        max:
                                          anyOf:
                                          - type: integer
                                          - type: string
                                          description: |-
                                            Max is the last generated value. Max must be reachable exactly by adding
                                            Step to Min zero or more times.
                                          example: "16000"
                                          pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                                          x-kubernetes-int-or-string: true
                                        min:
                                          anyOf:
                                          - type: integer
                                          - type: string
                                          description: Min is the first generated
                                            value.
                                          example: "2000"
                                          pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                                          x-kubernetes-int-or-string: true
                                        step:
                                          anyOf:
                                          - type: integer
                                          - type: string
                                          description: |-
                                            Step is added to the previous value until Max is reached. Step must be
                                            greater than zero.
                                          example: "2000"
                                          pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
                                          x-kubernetes-int-or-string: true
                                      required:
                                      - max
                                      - min
                                      - step
                                      type: object
                                    variants:
                                      description: |-
                                        Variants lists explicit resource variants in order. When the resource is
                                        in a multi-resource dimension, its variant count must equal every other
                                        resource in that dimension.
                                      example:
                                      - "2"
                                      - "4"
                                      - "8"
                                      items:
                                        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
                                      minItems: 1
                                      type: array
                                  required:
                                  - name
                                  type: object
                                  x-kubernetes-validations:
                                  - message: exactly one of variants or range must
                                      be set
                                    rule: has(self.variants) != has(self.range)
                                minItems: 1
                                type: array
                            required:
                            - resources
                            type: object
                          minItems: 1
                          type: array
                      required:
                      - dimensions
                      type: object
                    minItems: 1
                    type: array
                  template:
                    description: |-
                      Template names the tier template used to render every generated tier.
                      The template defines matchers, params, and the patch template. Resource
                      combinations generated by Sets are matched against that template.
                    properties:
                      name:
                        description: |-
                          Name is the template name. The name must resolve to a template loaded
                          from the tier template configuration when tiers are materialized.
                        example: standard
                        minLength: 1
                        type: string
                    required:
                    - name
                    type: object
                required:
                - sets
                - template
                type: object
            required:
            - metrics
            - mode
            - targetRef
            - tiers
            type: object
          status:
            description: AutoscalerStatus is written by the capacity planner (design
              §3.3).
            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
              observedGeneration:
                format: int64
                type: integer
            type: object
        required:
        - spec
        type: object
    served: true
    storage: true
    subresources:
      status: {}
