How ot-container-kit/redis-operator works
Redis Operator manages standalone, cluster, replication, and Sentinel Redis deployments on Kubernetes. Users submit Redis custom resources; the manager registers controllers, which reconcile those resources into Kubernetes workloads and services and maintain distributed Redis topology. The repo also includes a bootstrap agent for Redis/Sentinel configuration and monitoring support. The README documents failover/recovery, TLS, authentication, IP-family support, and exporter-based monitoring; source excerpts show several controller-to-Kubernetes actions, but not every implementation detail.
Main entry points: cmd.go Manager · redisreplication_controller.go Replication reconciler · redis_controller.go Standalone reconciler · rediscluster_controller.go Cluster reconciler
Components 20
Operator runtime
- Manager
internal/cmd/manager/cmd.go - Agent command
internal/cmd/agent/cmd.go - Bootstrap command
internal/cmd/agent/bootstrap/cmd.go
Resource APIs
- Standalone API
api/redis/v1beta2/redis_webhook.go - Cluster API
api/rediscluster/v1beta2/rediscluster_webhook.go - Replication API
api/redisreplication/v1beta2/redisreplication_webhook.go - Sentinel API
api/redissentinel/v1beta2/redissentinel_webhook.go
Redis reconciliation
- Standalone reconciler
internal/controller/redis/redis_controller.go - Cluster reconciler
internal/controller/rediscluster/rediscluster_controller.go - Replication reconciler
internal/controller/redisreplication/redisreplication_controller.go - Sentinel reconciler
internal/controller/redissentinel/redissentinel_controller.go - Kubernetes resources
internal/k8sutils/services.go - Redis client
internal/service/redis/client.go
Bootstrap and monitoring
- Redis bootstrap config
internal/agent/bootstrap/redis/config.go - Sentinel bootstrap config
internal/agent/bootstrap/sentinel/config.go - Bootstrap task
internal/agent/bootstrap/task.go - Metrics
internal/monitoring
Other components
- Cluster operator
- Kubernetes API
- Prometheus
Connections 24
- Cluster operator → Kubernetes API: submits resources
README.md - Manager → Standalone reconciler: registers
internal/cmd/manager/cmd.go - Manager → Cluster reconciler: registers
internal/cmd/manager/cmd.go - Manager → Replication reconciler: registers
internal/cmd/manager/cmd.go - Manager → Sentinel reconciler: registers
internal/cmd/manager/cmd.go - Manager → Metrics: registers metrics
internal/cmd/manager/cmd.go - Agent command → Bootstrap command: dispatches
- Bootstrap command → Bootstrap task: runs
internal/cmd/agent/bootstrap/cmd.go - Bootstrap task → Redis bootstrap config: generates config
internal/agent/bootstrap/task.go - Bootstrap task → Sentinel bootstrap config: generates config
internal/agent/bootstrap/task.go - Standalone reconciler → Kubernetes resources: creates workloads
internal/controller/redis/redis_controller.go - Cluster reconciler → Kubernetes resources: creates cluster resources
internal/controller/rediscluster/rediscluster_controller.go - Replication reconciler → Kubernetes resources: configures replication
internal/controller/redisreplication/redisreplication_controller.go - Replication reconciler → Redis client: connects to Redis
internal/controller/redisreplication/redisreplication_controller.go - Sentinel reconciler → Kubernetes resources: reconciles services
internal/controller/redissentinel/redissentinel_controller.go - Metrics → Prometheus: exposes metrics
README.md - Standalone API → Standalone reconciler: defines resource
- Cluster API → Cluster reconciler: defines resource
- Replication API → Replication reconciler: defines resource
- Sentinel API → Sentinel reconciler: defines resource
- Kubernetes API → Standalone reconciler: watches resources
- Kubernetes API → Cluster reconciler: watches resources
- Kubernetes API → Replication reconciler: watches resources
- Kubernetes API → Sentinel reconciler: watches resources