This directory contains comprehensive documentation for the TNF lifecycle system in the cluster-etcd-operator.
| Topic | Document | Description |
|---|---|---|
| System Design | architecture-overview.md | High-level architecture, dual-mode operation, component overview |
| Controller Behavior | controller-lifecycle.md | Startup sequence, periodic sync loop, event handling, health monitoring |
| Job Management | job-controllers.md | Bootstrap vs runtime job behavior, retry logic, node selection |
| Drift Detection | reconciliation.md | When reconciliation runs, drift scenarios, safety checks |
The TNF lifecycle system manages the integration between OpenShift control plane nodes and a Pacemaker high-availability cluster. It operates in two modes:
Bootstrap Mode (Pre-Transition)
- Drives initial etcd transition from static pods to Pacemaker control
- Requires exactly 2 ready control plane nodes
- Uses exponential backoff retry logic
- Sets degraded conditions on failure
Runtime Mode (Post-Transition)
- Monitors Pacemaker cluster health every 30 seconds
- Detects drift between Kubernetes nodes and Pacemaker membership
- Automatically reconciles differences by adding/removing nodes
- Supports single-node scenarios during node replacement
PacemakerLifecycleManager (pkg/tnf/operator/lifecycle_manager.go)
- Main controller coordinating all TNF operations
- Runs periodic sync loop (every 30 seconds)
- Registers event handlers for node Add/Update/Delete
StartJobControllers (pkg/tnf/operator/lifecycle_job_controllers.go)
- Manages TNF job lifecycle
- Dual-mode behavior (bootstrap vs runtime)
- Handles operator restarts gracefully
ReconcilePacemakerConfig (pkg/tnf/operator/lifecycle_reconciliation.go)
- Detects and fixes drift between K8s and Pacemaker
- Creates update-setup ConfigMaps with reconciliation decisions
- Protected by mutex to serialize reconciliation attempts
MonitorHealth (pkg/tnf/operator/lifecycle_health.go)
- Monitors Pacemaker cluster health
- Updates operator conditions (Degraded, Progressing, Available)
- Records events with deduplication
| Job Type | Scope | When | Purpose |
|---|---|---|---|
| auth | Per-node | Bootstrap + reconciliation | Set hacluster password |
| setup | Cluster | Bootstrap only | Initial Pacemaker cluster creation |
| after-setup | Per-node | Bootstrap only | Add node to newly created cluster |
| fencing | Cluster | Bootstrap + secret changes | Configure STONITH fencing agents |
| update-setup | Cluster | Reconciliation | Add/remove nodes from existing cluster |
Initial Bootstrap
- Wait for etcd bootstrap completion
- Wait for all nodes at latest revision
- Run auth jobs on all nodes
- Run setup job (creates Pacemaker cluster)
- Run fencing job (configures STONITH)
- Run after-setup jobs on all nodes
- Mark transition complete
Node Replacement (Reconciliation)
- Detect drift (K8s has different nodes than Pacemaker)
- Create update-setup ConfigMap with desired state
- Run auth jobs on all current K8s nodes
- Run update-setup job (add/remove nodes from Pacemaker)
- Run after-setup jobs on all current K8s nodes
- Clean up orphaned jobs for deleted nodes
Health Monitoring
- Read PacemakerCluster CR status (updated every 1 minute)
- Check staleness (CR updated recently?)
- Parse cluster state (nodes online, fencing status, errors)
- Update operator conditions
- Record events with deduplication
Self-Healing
- Periodic reconciliation detects and fixes drift automatically
- Recovers from missed events or operator downtime
Graceful Degradation
- Operations continue independently
- Health check failure doesn't prevent reconciliation
Idempotency
- Safe to call repeatedly
- Operations detect current state and only act when needed
Event + Periodic Hybrid
- Node events trigger immediate action
- Periodic sync provides backup detection and recovery