How ardikabs/hibernator works
Hibernator is a Kubernetes operator for scheduled, dependency-aware suspension and restoration of cloud and Kubernetes infrastructure. Users declare HibernatePlans and related connector, exception, and notification resources; the controller evaluates schedules and coordinates isolated runner jobs, whose pluggable executors perform operations and persist restore metadata. Progress and logs return through authenticated streaming, while lifecycle notifications fan out to configured sinks. The CLI supports plan operations and restore-state management. The README documents these capabilities; sampled source confirms controller setup, runner configuration, streaming service behavior, and restore ConfigMap access, but not every controller-to-job call.
Main entry points: provider.go Resource provider · app.go Runner application · interface.go Cloud executors · coordinator.go Plan state coordinator
Components 24
Control plane
- Custom resources
api/v1alpha1/hibernateplan_types.go - Controller manager
cmd/controller/app/app.go - Resource provider
internal/provider/provider.go - Schedule planner
internal/scheduler/planner.go - Plan state coordinator
internal/provider/processor/plan/coordinator.go - Schedule exceptions
internal/provider/processor/scheduleexception/lifecycle.go
Execution
- Isolated runner jobs
internal/provider/processor/plan/worker.go - Runner application
cmd/runner/app/app.go - Cloud executors
internal/executor/interface.go - EKS executor
internal/executor/eks/eks.go - RDS executor
internal/executor/rds/rds.go - EC2 executor
internal/executor/ec2/ec2.go
Feedback and state
- Restore manager
internal/restore/manager.go - Restore metadata
- Streaming setup
internal/streaming/manager.go - Execution service
internal/streaming/server/service.go - Runner stream clients
internal/streaming/client/client.go - Notification dispatch
internal/notification/dispatcher.go - Notification sinks
internal/notification/sink/sink.go
User interfaces
- kubectl-hibernator
cmd/kubectl-hibernator/cli/root.go
Other components
- Operator users
- Kubernetes API
- Cloud services
- Notification recipients
Connections 26
- Operator users → kubectl-hibernator: runs commands
- Operator users → Custom resources: declares resources
- kubectl-hibernator → Kubernetes API: reads and updates
- Controller manager → Resource provider: sets up
- Controller manager → Streaming setup: sets up
- Resource provider → Schedule planner: evaluates schedules
- Resource provider → Plan state coordinator: registers processing
- Resource provider → Schedule exceptions: registers processing
- Plan state coordinator → Isolated runner jobs: coordinates jobs
- Isolated runner jobs → Runner application: starts job
- Runner application → Cloud executors: selects executor
- Cloud executors → EKS executor: implements
- Cloud executors → RDS executor: implements
- Cloud executors → EC2 executor: implements
- EKS executor → Cloud services: operates resources
- RDS executor → Cloud services: operates resources
- EC2 executor → Cloud services: operates resources
- Runner application → Restore manager: persists restore state
- Restore manager → Restore metadata: reads and writes
- Runner application → Runner stream clients: streams progress
- Runner stream clients → Execution service: sends logs and status
- Streaming setup → Execution service: hosts service
- Execution service → Kubernetes API: reads plan metadata
- Plan state coordinator → Notification dispatch: emits lifecycle events
- Notification dispatch → Notification sinks: dispatches messages
- Notification sinks → Notification recipients: delivers notifications