Commit 95444b3
committed
MGMT-21201: Enable dual-stack clusters
The lifecycle-agent is a core component responsible for managing Image-Based Upgrades (IBU) and Image-Based Install (IBI) operations in OpenShift Single Node OpenShift (SNO) clusters. It handles critical cluster lifecycle operations including:
- **Network Configuration Management**: Configuring node IPs, machine networks, cluster networks, and service networks during cluster transitions
- **Recertification (Recert)**: Re-signing certificates with updated cluster information (IPs, hostnames, etc.) when transforming seed images into target clusters
- **Post-Pivot Operations**: Managing network setup, DNS configuration, and kubelet configuration after cluster pivot operations
- **Seed Cluster Information**: Capturing and transforming network details from seed clusters for target cluster deployment
Currently, the lifecycle-agent's network handling is designed around single-stack networking, where clusters operate on either IPv4 OR IPv6, but not both simultaneously. All network-related data structures use single string fields (`NodeIP`, `MachineNetwork`) and the logic assumes a single IP address per network interface.
Key components involved:
- `api/seedreconfig`: Defines the `SeedReconfiguration` API for cluster transformation parameters
- `utils/client_helper.go`: Extracts cluster network information from Kubernetes API
- `lca-cli/postpivot`: Handles post-upgrade network configuration and kubelet setup
- `internal/recert`: Manages certificate re-signing with updated network information
- `lca-cli/seedclusterinfo`: Captures seed cluster network details for replication
**[MGMT-21201](https://issues.redhat.com//browse/MGMT-21201)**: The lifecycle-agent needs to support dual-stack networking configurations where OpenShift clusters operate with both IPv4 and IPv6 addresses simultaneously on the same interfaces.
1. **Single IP Assumption**: All network fields (`NodeIP`, `MachineNetwork`) are single strings, preventing multiple IP support
2. **Limited Network Discovery**: Cluster info extraction only captures the first internal IP address
3. **Inadequate Recert Logic**: Certificate re-signing only handles single IP changes
4. **Kubelet Configuration**: Node IP hint generation assumes single network per stack
5. **Missing Test Coverage**: No validation for dual-stack scenarios
- Support IPv4 + IPv6 dual-stack clusters in IBU/IBI operations
- Maintain 100% backward compatibility with existing single-stack configurations
- Handle multiple machine networks per IP family
- Update recert logic to process multiple IP addresses in certificate SANs
- Ensure proper kubelet configuration for dual-stack node IPs
- **Added `NodeIPs []string`** to `SeedReconfiguration` and `SeedClusterInfo` for multiple node IPs
- **Added `MachineNetworks []string`** to support multiple machine network CIDRs
- **Preserved legacy fields** (`NodeIP`, `MachineNetwork`) for backward compatibility with precedence rules
- **Enhanced `GetClusterInfo()`** to discover all internal node IPs via `getNodeInternalIPs()`
- **Added `getMachineNetworks()`** to extract all machine networks from install config
- **Implemented backward compatibility** by populating legacy fields with first array element
- **Updated `setNodeIpHint()`** to generate space-separated IP hints: `KUBELET_NODEIP_HINT=<ip1> <ip2>`
- **Refactored `setNodeIPIfNotProvided()`** to parse kubelet config from `/etc/systemd/system/kubelet.service.d/20-nodenet.conf`
- **Added `parseKubeletNodeIPs()`** function to extract both `KUBELET_NODE_IP` and `KUBELET_NODE_IPS` environment variables
- **Enhanced file validation** to check for both existence AND valid content before triggering `nodeip-configuration` service
- **Implemented `slices.Equal()`** comparison for clean IP change detection
- **Updated config IP format** to comma-separated list: `config.IP = "ip1,ip2"` for multiple addresses
- **Enhanced certificate SAN rules** to include all old and new IP addresses in replacement rules
- ✅ Single-stack IPv4 and IPv6 configurations
- ✅ Dual-stack (IPv4 + IPv6) with both primary orders
- ✅ Multiple networks per IP family
- ✅ Legacy → new field migration scenarios
- ✅ Error handling and edge cases
- ✅ Backward compatibility validation
**100% backward compatibility maintained**:
- Existing single-stack clusters continue to work without modification
- Legacy `NodeIP` and `MachineNetwork` fields preserved and populated
- New fields (`NodeIPs`, `MachineNetworks`) take precedence when specified
- All existing APIs and behavior unchanged for single-stack scenarios
- **All existing tests pass** - no regressions introduced
- **59 new test cases** covering all dual-stack scenarios
- **Production-ready validation** for IPv4, IPv6, and dual-stack configurations
- **Edge case coverage** including empty configs, invalid data, and service interactions1 parent 8698fd7 commit 95444b3
File tree
12 files changed
+1338
-139
lines changed- api/seedreconfig
- internal
- clusterconfig
- recert
- lca-cli
- postpivot
- seedclusterinfo
- utils
12 files changed
+1338
-139
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
54 | 61 | | |
55 | 62 | | |
56 | 63 | | |
| |||
102 | 109 | | |
103 | 110 | | |
104 | 111 | | |
| 112 | + | |
105 | 113 | | |
106 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
107 | 125 | | |
108 | 126 | | |
109 | 127 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
459 | 459 | | |
460 | 460 | | |
461 | 461 | | |
462 | | - | |
| 462 | + | |
463 | 463 | | |
464 | 464 | | |
465 | 465 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
| 312 | + | |
312 | 313 | | |
313 | 314 | | |
314 | 315 | | |
| |||
320 | 321 | | |
321 | 322 | | |
322 | 323 | | |
| 324 | + | |
323 | 325 | | |
324 | 326 | | |
325 | 327 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| |||
14 | 15 | | |
15 | 16 | | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
17 | 40 | | |
18 | 41 | | |
19 | 42 | | |
| |||
121 | 144 | | |
122 | 145 | | |
123 | 146 | | |
124 | | - | |
125 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
126 | 153 | | |
127 | 154 | | |
128 | 155 | | |
| |||
168 | 195 | | |
169 | 196 | | |
170 | 197 | | |
171 | | - | |
172 | 198 | | |
173 | 199 | | |
174 | 200 | | |
175 | 201 | | |
176 | | - | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
177 | 211 | | |
178 | 212 | | |
179 | 213 | | |
| |||
0 commit comments