github.com/gocrane/crane@v0.11.0/examples/autoscaling/effective-hpa-cron-local.yaml (about)

     1  apiVersion: autoscaling.crane.io/v1alpha1
     2  kind: EffectiveHorizontalPodAutoscaler
     3  metadata:
     4    name: php-apache-local
     5  spec:
     6    # ScaleTargetRef is the reference to the workload that should be scaled.
     7    scaleTargetRef:
     8      apiVersion: apps/v1
     9      kind: Deployment
    10      name: php-apache
    11    minReplicas: 1        # MinReplicas is the lower limit replicas to the scale target which the autoscaler can scale down to.
    12    maxReplicas: 10       # MaxReplicas is the upper limit replicas to the scale target which the autoscaler can scale up to.
    13    scaleStrategy: Auto   # ScaleStrategy indicate the strategy to scaling target, value can be "Auto" and "Preview".
    14    # Better to setting cron to fill the one complete time period such as one day, one week
    15    # Below is one day cron scheduling, it
    16    #100                  --------     ---------        ----------
    17    #                    |       |    |        |       |         |
    18    #1        ------------       -----         --------          ----------
    19    #(time)   0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
    20    # Local timezone means you use the server's(or maybe is a container's) timezone which the craned running in. for example, if your craned started as utc timezone, then it is utc. if it started as Asia/Shanghai, then it is Asia/Shanghai.
    21    crons:
    22      - name: "cron1"
    23        timezone: "Local"
    24        description: "keep normal"
    25        start: "0 0 ? * *"
    26        end: "0 6 ? * *"
    27        targetReplicas: 1
    28      - name: "cron2"
    29        timezone: "Local"
    30        description: "scale up"
    31        start: "0 6 ? * *"
    32        end: "0 9 ? * *"
    33        targetReplicas: 100
    34      - name: "cron3"
    35        timezone: "Local"
    36        description: "scale down"
    37        start: "00 9 ? * *"
    38        end: "00 11 ? * *"
    39        targetReplicas: 1
    40      - name: "cron4"
    41        timezone: "Local"
    42        description: "scale up"
    43        start: "00 11 ? * *"
    44        end: "00 14 ? * *"
    45        targetReplicas: 100
    46      - name: "cron5"
    47        timezone: "Local"
    48        description: "scale down"
    49        start: "00 14 ? * *"
    50        end: "00 17 ? * *"
    51        targetReplicas: 1
    52      - name: "cron6"
    53        timezone: "Local"
    54        description: "scale up"
    55        start: "00 17 ? * *"
    56        end: "00 20 ? * *"
    57        targetReplicas: 100
    58      - name: "cron7"
    59        timezone: "Local"
    60        description: "keep normal"
    61        start: "00 20 ? * *"
    62        end: "00 00 ? * *"
    63        targetReplicas: 1