Commit deae213
committed
OCPBUGS-32174: save correct bootstrap public IP
When the BYOIPv4 feature was introduced to the terraform provisioning in
50c0a9d, a new EIP resource was created unconditionally. The
bootstrap VM was first getting a public IP from the `associate_public_ip_address` config in the instance and that IP was
then discarded when the EIP was created and associated with the instance.
However, a "race" could happen in which, at the end of the bootstrap
stage, we saved the first (and now dead) IP address:
```
DEBUG Outputs:
DEBUG
DEBUG bootstrap_ip = "18.222.119.149"
DEBUG [INFO] running Terraform command: /c/terraform/bin/terraform output -no-color -json
DEBUG {
DEBUG "bootstrap_ip": {
DEBUG "sensitive": false,
DEBUG "type": "string",
DEBUG "value": "18.222.119.149"
DEBUG }
DEBUG }
```
In case of bootstrap failure, the `gather bootstrap` would use the stale
IP address and fail to connect:
```
time="2024-04-12T15:08:49Z" level=info msg="Failed to gather bootstrap logs: failed to connect to the bootstrap machine: dial tcp 18.222.119.149:22: connect: connection timed out"
```
instead of using the actual EIP address "18.225.29.102".
This changes proposes the following fixes:
1. Only create an EIP if a public IPv4 pool has been specified.
2. Only `associate_public_ip_address` to the bootstrap instance if
public IPv4 pools have *not* been specified.
3. At the end of the bootstrap stage, save the correct IP address by
considering whether the bootstrap EIP was created or not.1 parent d8c7872 commit deae213
2 files changed
+5
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
164 | | - | |
| 164 | + | |
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| |||
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| 254 | + | |
254 | 255 | | |
255 | 256 | | |
256 | | - | |
| 257 | + | |
257 | 258 | | |
258 | 259 | | |
259 | | - | |
| 260 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
| 2 | + | |
3 | 3 | | |
0 commit comments