cron-hpa-controller

command module
v0.0.0-...-f2f495e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

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 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.

Build

$ make build
or
$ go build -o bin/cron-hpa-controller .

Run

# 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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg
apis/cronhpacontroller/v1
Package v1 is the v1 version of the API.
Package v1 is the v1 version of the API.
client/clientset/versioned
This package has the automatically generated clientset.
This package has the automatically generated clientset.
client/clientset/versioned/fake
This package has the automatically generated fake clientset.
This package has the automatically generated fake clientset.
client/clientset/versioned/scheme
This package contains the scheme of the automatically generated clientset.
This package contains the scheme of the automatically generated clientset.
client/clientset/versioned/typed/cronhpacontroller/v1
This package has the automatically generated typed clients.
This package has the automatically generated typed clients.
client/clientset/versioned/typed/cronhpacontroller/v1/fake
Package fake has the automatically generated clients.
Package fake has the automatically generated clients.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL