This is a Kubernetes controller that scales deployments up and down.
kube-synthetic-scaler is a controller that watches deployment objects for a ScalingSignalAnnotation and regularly scales deployments that have opted in down to 0 and back up to the original number of replicas at a specified interval. The interval defaults to the value set by the default-scaling-interval flag, unless configured separately by the deployment using the ScalingDurationAnnotation. It also sends a health check saying whether the scaling was successful or not.
This controller was originally created as part of a synthetic test framework to ensure that mutating webhooks are running and properly mutating new deployments. As such, dummy test deployments should be used with the scaler, rather than actual production deployments.
Make sure you have kubectl and Helm installed. For building and testing Docker images locally, ensure you have Docker installed.
You can choose between several options for running kube-synthetic-scaler:
-
To run the Go binary locally on your kubeconfig's current context:
make run
-
To install a Helm chart on your kubeconfig's current context using Helm 3 and the Docker Hub image:
helm upgrade --install kube-synthetic-scaler helm/kube-synthetic-scaler --namespace <namespace>
Note that this assumes the given namespace already exists within the cluster.
To uninstall the kube-synthetic-scaler Helm chart afterwards, run
helm uninstall kube-synthetic-scaler --namespace <namespace>
-
To build a local Docker image (defaulting to the "salesforce/kube-synthetic-scaler:latest" tag) for testing code changes, simply run:
make docker-build