Skip to content

Commit 3fac15b

Browse files
authored
Merge pull request #9712 from k8s-infra-cherrypick-robot/cherry-pick-9697-to-release-1.4
[release-1.4] 🌱 CAPD: Set Condition, if creating external LB failed.
2 parents e318aa0 + d086ffa commit 3fac15b

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

test/infrastructure/docker/internal/controllers/dockercluster_controller.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,12 +78,6 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
7878
log = log.WithValues("Cluster", klog.KObj(cluster))
7979
ctx = ctrl.LoggerInto(ctx, log)
8080

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-
8781
// Initialize the patch helper
8882
patchHelper, err := patch.NewHelper(dockerCluster, r.Client)
8983
if err != nil {
@@ -99,6 +93,13 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
9993
}
10094
}()
10195

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+
102103
// Support FailureDomains
103104
// In cloud providers this would likely look up which failure domains are supported and set the status appropriately.
104105
// In the case of Docker, failure domains don't mean much so we simply copy the Spec into the Status.

0 commit comments

Comments
 (0)