github.com/gocrane/crane@v0.11.0/examples/autoscaling/effective-hpa-cron.yaml (about) 1 apiVersion: autoscaling.crane.io/v1alpha1 2 kind: EffectiveHorizontalPodAutoscaler 3 metadata: 4 name: php-apache 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 crons: 21 - name: "cron1" 22 description: "keep normal" 23 start: "0 0 ? * *" 24 end: "0 6 ? * *" 25 targetReplicas: 1 26 - name: "cron2" 27 description: "scale up" 28 start: "0 6 ? * *" 29 end: "0 9 ? * *" 30 targetReplicas: 100 31 - name: "cron3" 32 description: "scale down" 33 start: "00 9 ? * *" 34 end: "00 11 ? * *" 35 targetReplicas: 1 36 - name: "cron4" 37 description: "scale up" 38 start: "00 11 ? * *" 39 end: "00 14 ? * *" 40 targetReplicas: 100 41 - name: "cron5" 42 description: "scale down" 43 start: "00 14 ? * *" 44 end: "00 17 ? * *" 45 targetReplicas: 1 46 - name: "cron6" 47 description: "scale up" 48 start: "00 17 ? * *" 49 end: "00 20 ? * *" 50 targetReplicas: 100 51 - name: "cron7" 52 description: "keep normal" 53 start: "00 20 ? * *" 54 end: "00 00 ? * *" 55 targetReplicas: 1