This repository is a comprehensive Terraform module for provisioning and managing AWS EKS (Elastic Kubernetes Service) clusters. It provides a modular, production-grade interface to create clusters with all supporting resources: IAM roles, security groups, VPC networking, encryption (KMS), logging, addons, identity providers (OIDC/IRSA), and access entries. The root module orchestrates multiple sub-modules for compute resources including EKS managed node groups, self-managed node groups (autoscaling groups), Fargate profiles, Karpenter integration, hybrid node roles, and EKS capabilities (ACK, ArgoCD, KRO). The architecture follows standard Terraform module patterns with extensive use of `for_each`, `dynamic` blocks, and conditional creation. The codebase demonstrates high craftsmanship through its modular design, comprehensive test infrastructure, and detailed upgrade guides that document breaking changes across major versions (v17 through v21). It includes an internal user data rendering sub-module that supports AL2, AL2023, Bottlerocket, and Windows AMIs, with both cloud-init and custom template support.
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.