Introductory reading:
make generate manifests
make install
make test
go tool cover -html=cover.out
make run
Deletes Knative Services whose effective min-scale is "0" once all their
Deployments have been at 0 replicas for longer than a configurable
threshold. Effective min-scale is the template annotation
autoscaling.knative.dev/min-scale when set. If Helm omitted it (numeric
0 is empty in with), the controller only treats that as zero when
IDLE_KNATIVE_CLUSTER_DEFAULT_SCALE_TO_ZERO=true — set this on preview
clusters whose Knative default is scale-to-zero. No ksvc patch and no
ConfigMap/RBAC. Explicit min-scale: "1" still excludes the Service.
This runs alongside ConditionalTTL’s creation-timestamp TTL cleanup, not
instead of it — both mechanisms are active at the same time;
IDLE_KNATIVE_CLEANUP_ENABLED only turns the idle mechanism on or off.
Disabled by default; opt in per cluster with env vars (no rebuild required):
| Env var | Default | Description |
|---|---|---|
IDLE_KNATIVE_CLEANUP_ENABLED |
false |
Set to true to also register the idle-cleanup controller. |
IDLE_KNATIVE_CLEANUP_THRESHOLD |
12h |
Go duration string (e.g. 6h, 30m) a Service may stay idle before deletion. |
IDLE_KNATIVE_CLUSTER_DEFAULT_SCALE_TO_ZERO |
false |
When true, missing template min-scale is treated as "0". |
Opt a specific Service out with the cleaner.vtex.io/exclude: "true"
annotation. Edit the controller code.
See the architecture diagram for a
visual overview of what each cleanup mechanism deletes and how the idle timer
resets on scale-up (make diagram).