Skip to content

Repository files navigation

Build Status Quality Gate Status

Cleaner Controller

Development Cheat Sheet

Introductory reading:

CRD Generation

  • Edit the go structs
  • Generate code and manifests:
     make generate manifests
  • (Optional) Install CRDs
     make install

Reconcile logic

  • Edit the controller code
  • Run tests
     make test
    • Check code coverage
     go tool cover -html=cover.out
  • Run controller locally (uses local k8s context authorization)
     make run

Idle Knative Service cleanup

Deletes Knative Services declaring autoscaling.knative.dev/min-scale: "0" once all their Deployments have been at 0 replicas for longer than a configurable threshold. 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.

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

Releases

Packages

Used by

Contributors

Languages