This k8s operator project,support timezone HPA with cronjob time
apiVersion: autoscaling.tomoku.com/v1beta1
kind: CronHPA
metadata:
name: cronhpa-test1
namespace: default
spec:
template:
spec:
behavior:
scaleDown:
stabilizationWindowSeconds: 1800
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: test1
minReplicas: 10
maxReplicas: 20
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 60
cron:
- name: "daytime"
schedule: "0 7 0 0 1-5"
timezone: "Asia/China"
minReplicas : 10
maxReplicas : 20
- name: "nighttime"
timezone: "Asia/China"
schedule: "0 19 0 0 1-5"
minReplicas : 5
maxReplicas : 20
mkdir cronhpa && cd cronhpa
go mod init cronhpa
kubebuilder init --domain tomoku.com
kubebuilder create api --group cronhpa --version v1 --kind CronHPA
make
make docker-build docker-push IMG=registry-qa.webex.com/meeting-common/cronhpa-operator:v0.1
make deploy IMG=registry-qa.webex.com/meeting-common/cronhpa-operator:v0.1
make uninstall
- get cronhpa
- if cronhpa exist
- update or create cronhpa
- create/update hpa(min,max), create/update cron