Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hex108/cron-hpa-controller
Controller for Cron Horizontal Pod Autoscaler(CronHPA)
https://github.com/hex108/cron-hpa-controller
cron-hpa-controller crontab hpa kubernetes operator
Last synced: 4 months ago
JSON representation
Controller for Cron Horizontal Pod Autoscaler(CronHPA)
- Host: GitHub
- URL: https://github.com/hex108/cron-hpa-controller
- Owner: hex108
- License: apache-2.0
- Created: 2018-12-29T14:25:27.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-12-05T09:25:25.000Z (over 4 years ago)
- Last Synced: 2024-01-18T11:33:13.439Z (6 months ago)
- Topics: cron-hpa-controller, crontab, hpa, kubernetes, operator
- Language: Go
- Homepage:
- Size: 4.83 MB
- Stars: 36
- Watchers: 4
- Forks: 6
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Lists
- awesome-controllers - hex108/cron-hpa-controller
README
**Notice: The repo has been moved to https://github.com/tkestack/cron-hpa, and it will be maintained there.**
-----------
# cron-hpa-controller
Cron Horizontal Pod Autoscaler(CronHPA) enables us to auto scale workloads(those support `scale` subresource, e.g. deployment, statefulset) periodically using [crontab](https://en.wikipedia.org/wiki/Cron) scheme.
`CronHPA` example:
```
apiVersion: gs.io/v1
kind: CronHPA
metadata:
name: example-cron-hpa
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: demo-deployment
crons:
- schedule: "0 23 * * 5" // Set replicas to 60 every Friday 23:00
targetReplicas: 60
- schedule: "0 23 * * 7" // Set replicas to 30 every Sunday 23:00
targetReplicas: 30
```More design ideas could be found at [design.md](./design.md).
## Build
``` sh
$ make build
or
$ go build -o bin/cron-hpa-controller .
```## Run
```sh
# assumes you have a working kubeconfig, not required if operating in-cluster
# It will create CRD `CronHPA` by default.
$ bin/cron-hpa-controller --master=127.0.0.1:8080 --v=5 --stderrthreshold=0 // Assume 127.0.0.1:8080 is k8s master ip:port
or
$ bin/cron-hpa-controller --kubeconfig=$HOME/.kube/config --v=5 --stderrthreshold=0# create a custom resource of type cron-hpa
$ kubectl create -f artifacts/examples/example-cron-hpa.yaml# check pods created through the custom resource
$ kubectl get cronhpa
```## Cleanup
You can clean up the created CustomResourceDefinition with:
$ kubectl delete crd cronhpas.gs.io