@@ -78,12 +78,6 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
78
78
log = log .WithValues ("Cluster" , klog .KObj (cluster ))
79
79
ctx = ctrl .LoggerInto (ctx , log )
80
80
81
- // Create a helper for managing a docker container hosting the loadbalancer.
82
- externalLoadBalancer , err := docker .NewLoadBalancer (ctx , cluster , dockerCluster )
83
- if err != nil {
84
- return ctrl.Result {}, errors .Wrapf (err , "failed to create helper for managing the externalLoadBalancer" )
85
- }
86
-
87
81
// Initialize the patch helper
88
82
patchHelper , err := patch .NewHelper (dockerCluster , r .Client )
89
83
if err != nil {
@@ -99,6 +93,13 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
99
93
}
100
94
}()
101
95
96
+ // Create a helper for managing a docker container hosting the loadbalancer.
97
+ externalLoadBalancer , err := docker .NewLoadBalancer (ctx , cluster , dockerCluster )
98
+ if err != nil {
99
+ conditions .MarkFalse (dockerCluster , infrav1 .LoadBalancerAvailableCondition , infrav1 .LoadBalancerProvisioningFailedReason , clusterv1 .ConditionSeverityWarning , err .Error ())
100
+ return ctrl.Result {}, errors .Wrapf (err , "failed to create helper for managing the externalLoadBalancer" )
101
+ }
102
+
102
103
// Support FailureDomains
103
104
// In cloud providers this would likely look up which failure domains are supported and set the status appropriately.
104
105
// In the case of Docker, failure domains don't mean much so we simply copy the Spec into the Status.
0 commit comments