Skip to content

Commit

Permalink
Merge pull request #9697 from guettli/mark-false-if-creating-lb-failed
Browse files Browse the repository at this point in the history
🌱 CAPD: Set Condition, if creating external LB failed.
  • Loading branch information
k8s-ci-robot committed Nov 13, 2023
2 parents e55c6bf + 2281c85 commit d170574
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,12 +80,6 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
log = log.WithValues("Cluster", klog.KObj(cluster))
ctx = ctrl.LoggerInto(ctx, log)

// Create a helper for managing a docker container hosting the loadbalancer.
externalLoadBalancer, err := docker.NewLoadBalancer(ctx, cluster, dockerCluster)
if err != nil {
return ctrl.Result{}, errors.Wrapf(err, "failed to create helper for managing the externalLoadBalancer")
}

// Initialize the patch helper
patchHelper, err := patch.NewHelper(dockerCluster, r.Client)
if err != nil {
Expand All @@ -101,6 +95,13 @@ func (r *DockerClusterReconciler) Reconcile(ctx context.Context, req ctrl.Reques
}
}()

// Create a helper for managing a docker container hosting the loadbalancer.
externalLoadBalancer, err := docker.NewLoadBalancer(ctx, cluster, dockerCluster)
if err != nil {
conditions.MarkFalse(dockerCluster, infrav1.LoadBalancerAvailableCondition, infrav1.LoadBalancerProvisioningFailedReason, clusterv1.ConditionSeverityWarning, err.Error())
return ctrl.Result{}, errors.Wrapf(err, "failed to create helper for managing the externalLoadBalancer")
}

// Support FailureDomains
// In cloud providers this would likely look up which failure domains are supported and set the status appropriately.
// In the case of Docker, failure domains don't mean much so we simply copy the Spec into the Status.
Expand Down

0 comments on commit d170574

Please sign in to comment.