Skip to content

Commit dd66072

Browse files
committed
docker: ensure BootstrapExecSucceeded v1beta2 condition also gets set during CAPI upgrades
1 parent ed3b35c commit dd66072

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test/infrastructure/docker/internal/controllers/backends/docker/dockermachine_backend.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,26 @@ func (r *MachineBackendReconciler) ReconcileNormal(ctx context.Context, cluster
126126
Status: metav1.ConditionTrue,
127127
Reason: infrav1.DevMachineDockerContainerProvisionedV1Beta2Reason,
128128
})
129+
// In case of upgrades the v1beta2 condition for BootstrapExecSucceeded does not exist.
130+
// In this case recover the information from the existing v1beta1 condition, because we do not know if
131+
// all commands succeeded.
132+
if !v1beta2conditions.Has(dockerMachine, infrav1.DevMachineDockerContainerBootstrapExecSucceededV1Beta2Condition) {
133+
condition := conditions.Get(dockerMachine, infrav1.BootstrapExecSucceededCondition)
134+
if condition == nil || condition.Status == corev1.ConditionTrue {
135+
v1beta2conditions.Set(dockerMachine, metav1.Condition{
136+
Type: infrav1.DevMachineDockerContainerBootstrapExecSucceededV1Beta2Condition,
137+
Status: metav1.ConditionTrue,
138+
Reason: infrav1.DevMachineDockerContainerBootstrapExecSucceededV1Beta2Reason,
139+
})
140+
} else {
141+
v1beta2conditions.Set(dockerMachine, metav1.Condition{
142+
Type: infrav1.DevMachineDockerContainerBootstrapExecSucceededV1Beta2Condition,
143+
Status: metav1.ConditionFalse,
144+
Message: condition.Message,
145+
Reason: infrav1.DevMachineDockerContainerBootstrapExecNotSucceededV1Beta2Reason,
146+
})
147+
}
148+
}
129149

130150
// Setting machine address is required after move, because status.Address field is not retained during move.
131151
if err := setMachineAddress(ctx, dockerMachine, externalMachine); err != nil {

0 commit comments

Comments
 (0)