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