Karpenter is a Kubernetes cluster autoscaler that provisions and manages compute capacity (nodes) for pods that cannot be scheduled. It operates as a controller-runtime-based operator, using Custom Resource Definitions (CRDs) like NodePool, NodeClaim, CapacityBuffer, and NodeOverlay to declaratively manage node lifecycle. The system continuously reconciles the desired state (unschedulable pods, disruption budgets, static replicas) with the actual cluster state, creating or deleting NodeClaims via a pluggable CloudProvider interface (with implementations for AWS, Azure, GCP, and a fake/KWOK provider for testing). Key entry points include the operator startup in `pkg/operator/operator.go`, the provisioning loop in `pkg/controllers/provisioning/provisioner.go`, and the disruption controller in `pkg/controllers/disruption/controller.go`. External dependencies are minimal: it requires a Kubernetes cluster with controller-runtime, Prometheus for metrics, and optional DRA (Dynamic Resource Allocation) support via a separate driver. The codebase is production-grade, with extensive unit and integration tests, performance benchmarks, and a well-defined event/metrics system.
This is the Kubernetes Autoscaler monorepo, containing multiple production-grade autoscaling components for Kubernetes: Cluster Autoscaler (horizontal node scaling), Vertical Pod Autoscaler (vertical pod resource scaling), Addon Resizer (resource adjustment for addons), and Balancer (workload distribution). The architecture is a collection of independent Go applications and libraries, each with its own entry points (main.go) and Kubernetes API extensions. The codebase is heavily multi-cloud, with vendored SDKs for over 15 cloud providers (AWS, GCE, Azure, OCI, Huawei, Alicloud, etc.) and extensive generated client code for custom CRDs. The core autoscaling logic is well-engineered, but the repository is bloated with auto-generated SDKs and boilerplate, leading to moderate technical drift risk. It is actively maintained with frequent commits and CI pipelines.