$ account prometheus-operator
This is a Kubernetes operator that manages the lifecycle of Prometheus, Alertmanager, and related monitoring components (Thanos Ruler, Prometheus Agent) as Kubernetes native resources. It provides Custom Resource Definitions (CRDs) for declarative configuration and automates deployment, scaling, configuration generation, TLS management, and reconciliation. The operator ensures that Prometheus and Alertmanager instances are correctly configured, updated, and monitored within a Kubernetes cluster, handling tasks such as secret injection, config reloading, and pod repair. The architecture is a monolithic Go binary using the controller-runtime pattern. It includes multiple sub-components: an admission webhook for validation and mutation of CRDs, a prometheus-config-reloader sidecar for dynamic config reload, and a kubelet controller for node endpoint management. The codebase is heavily generated (client-go, apply configurations, informers) and relies on Kubernetes APIs, Prometheus/Alertmanager container images, and optional cloud SDKs (AWS, Azure) for service discovery. Key entry points are `cmd/operator/main.go` (main operator binary), `cmd/admission-webhook/main.go` (webhook server), and `cmd/prometheus-config-reloader/main.go` (config reloader). Data flows: users define CRDs → operator reconciles into StatefulSets/DaemonSets, generates Prometheus/Alertmanager config files with TLS/auth, and manages config reloads. External dependencies include a Kubernetes cluster, Prometheus/Alertmanager container images, and optional cloud services for scrape config discovery.