How stakater/reloader works
Reloader is a Kubernetes controller that watches configuration resources and triggers workload rollouts when relevant Secrets or ConfigMaps change. Its main path is cluster events through controller queues to reload handlers and Kubernetes workload updates; annotation-based selection, optional CSI support, notifications, HA leadership, and Prometheus metrics are additional capabilities. The README documents supported workload types and controls; unsampled implementation details are represented only at their supported directory paths.
Main entry points: handler Reload handlers · reloader.go Startup and setup · controller.go Resource controllers · rolling_upgrade.go Workload updates
Components 22
Controller runtime
- Process entry
main.go - Application runner
internal/pkg/app/app.go - Startup and setup
internal/pkg/cmd/reloader.go - Resource controllers
internal/pkg/controller/controller.go - Work queue
internal/pkg/controller/controller.go
Reload decisions
- Reload handlers
internal/pkg/handler - Reload configuration
pkg/common/common.go - Resource hashing
internal/pkg/util/util.go - SHA generation
internal/pkg/crypto/sha.go - Workload updates
internal/pkg/callbacks/rolling_upgrade.go
Cluster integrations
- Cluster clients
pkg/kube/client.go - Resource mapping
pkg/kube/resourcemapper.go - CSI secrets
internal/pkg/controller/controller.go
Operations
- Leader election
internal/pkg/leadership/leadership.go - Prometheus metrics
internal/pkg/metrics/prometheus.go - Notifications
internal/pkg/alerts
Other components
- Cluster operator
- Secrets and ConfigMaps
- Kubernetes API
- Workloads
- Prometheus
- Webhook or chat
Connections 24
- Cluster operator → Secrets and ConfigMaps: updates
- Secrets and ConfigMaps → Kubernetes API: stored in
- Process entry → Application runner: runs
- Application runner → Startup and setup: executes
- Startup and setup → Cluster clients: creates
- Startup and setup → Resource controllers: starts
- Startup and setup → Leader election: coordinates
- Kubernetes API → Resource controllers: sends events
- Resource controllers → Work queue: enqueues
- Work queue → Reload handlers: dispatches
- Reload handlers → Reload configuration: checks rules
- Reload handlers → Resource hashing: computes change
- Resource hashing → SHA generation: hashes data
- Reload handlers → Resource mapping: maps resources
- Reload handlers → Workload updates: requests rollout
- Workload updates → Cluster clients: uses clients
- Cluster clients → Kubernetes API: reads and writes
- Workload updates → Workloads: patches or restarts
- Resource controllers → Prometheus metrics: records events
- Reload handlers → Prometheus metrics: records actions
- Prometheus metrics → Prometheus: exposes metrics
- Resource controllers → CSI secrets: handles optional events
- Startup and setup → Notifications: configures
- Notifications → Webhook or chat: sends notifications