kind: CustomResourceDefinition
apiVersion: apiextensions.k8s.io/v1
metadata:
  annotations:
    polaris-slo-cloud.github.io/schema-gen-version: 0.2.0-beta.19
  name: horizontalelasticitystrategies.elasticity.polaris-slo-cloud.github.io
spec:
  group: elasticity.polaris-slo-cloud.github.io
  names:
    kind: HorizontalElasticityStrategy
    listKind: HorizontalElasticityStrategyList
    singular: horizontalelasticitystrategy
    plural: horizontalelasticitystrategies
  scope: Namespaced
  versions:
    - name: v1
      served: true
      storage: true
      schema:
        openAPIV3Schema:
          type: object
          required:
            - metadata
            - spec
            - apiVersion
            - kind
          description: Denotes an elasticity strategy that employs horizontal scaling.
          properties:
            metadata:
              type: object
            spec:
              type: object
              required:
                - targetRef
                - sloOutputParams
              description: >-
                A generic class that is used to set up specs for an elasticity
                strategy.


                A concrete `ElasticityStrategy` may use
                `ElasticityStrategySpec<T>` directly as the type for its spec,
                or a class derived from this one, if, e.g., the transformation
                needs to be customized.


                Parameters that are defined by the output of the SLO are stored
                in `sloOutputParams`. The type of this property determines if an
                elasticity strategy is compatible with a certain SLO.


                `staticConfig` should be used for other configuration data,
                which is not changed by the SLO.
              properties:
                targetRef:
                  type: object
                  required:
                    - kind
                    - name
                    - apiVersion
                  description: Identifies that target workload for an SLO mapping.
                  properties:
                    kind:
                      type: string
                      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
                    name:
                      type: string
                      description: The name of the instance.
                    apiVersion:
                      type: string
                      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
                sloOutputParams:
                  type: object
                  properties:
                    currSloCompliancePercentage:
                      type: integer
                      description: >-
                        Specifies how much the current state of the system
                        complies with the SLO.


                        This value must be specified as an integer, e.g., `50`
                        meaning 50%, `100` meaning 100%, `200` meaning 200%.


                        If this value is `100`, the SLO is met exactly and no
                        scaling action is required.


                        If this value is greater than `100`, the SLO is violated
                        and scaling out/up is required.


                        If this value is less than `100`, the system is
                        performing better than the SLO demands and scaling
                        in/down will be performed.
                      format: int64
                    tolerance:
                      type: integer
                      description: >-
                        Specifies the tolerance around 100%, within which no
                        scaling will be performed.


                        For example, if tolerance is `10`, no scaling will be
                        performed as long as `currSloCompliancePercentage` is
                        between `90` and `110`.
                      format: int64
                  required:
                    - currSloCompliancePercentage
                  description: >-
                    Defines a generic mechanism for specifying how much an SLO
                    is being violated or outperformed.
                stabilizationWindow:
                  type: object
                  description: >-
                    StabilizationWindow allows configuring the period of time
                    that an elasticity strategy controller will wait after
                    applying the strategy once, before applying it again (if the
                    SLO is still violated), to avoid unnecessary scaling.


                    For example, suppose that ScaleUpSeconds = 180 and a
                    horizontal elasticity strategy scales out at time `t` due to
                    an SLO violation. At time `t + 20 seconds` the SLO's
                    evaluation still results in a violation, but the elasticity
                    strategy does not scale again, because the stabilization
                    window for scaling up/out has not yet passed. If the SLO
                    evaluation at `t + 200 seconds` still results in a
                    violation, the controller will scale again.
                  properties:
                    scaleUpSeconds:
                      type: integer
                      description: >-
                        The number of seconds after the previous scaling
                        operation to wait before an elasticity action that
                        increases resources (e.g., scale up/out) or an
                        equivalent configuration change can be issued due to an
                        SLO violation.
                      minimum: 0
                      default: 60
                      format: int64
                    scaleDownSeconds:
                      type: integer
                      description: >-
                        The number of seconds after the previous scaling
                        operation to wait before an elasticity action that
                        decreases resources (e.g., scale down/in) or an
                        equivalent configuration change can be issued due to an
                        SLO violation.
                      minimum: 0
                      default: 300
                      format: int64
                staticConfig:
                  type: object
                  properties:
                    minReplicas:
                      type: integer
                      description: >-
                        The minimum number of replicas that the target workload
                        must have.
                      default: 1
                      format: int64
                    maxReplicas:
                      type: integer
                      description: >-
                        The maximum number of replicas that the target workload
                        may have.


                        Default: unlimited
                      format: int64
                  description: >-
                    Commonly used, optional, static configuration for an
                    elasticity strategy that employs horizontal scaling.
            apiVersion:
              type: string
              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
            kind:
              type: string
              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
