Skip to content

Commit 75d1d40

Browse files
author
Matt Pryor
committed
Fix linting issues
1 parent d185191 commit 75d1d40

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

controllers/openstackcluster_controller.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,11 +447,12 @@ func reconcileNetworkComponents(log logr.Logger, osProviderClient *gophercloud.P
447447

448448
// Calculate the port that we will use for the API server
449449
var apiServerPort int
450-
if openStackCluster.Spec.ControlPlaneEndpoint.IsValid() {
450+
switch {
451+
case openStackCluster.Spec.ControlPlaneEndpoint.IsValid():
451452
apiServerPort = int(openStackCluster.Spec.ControlPlaneEndpoint.Port)
452-
} else if openStackCluster.Spec.APIServerPort != 0 {
453+
case openStackCluster.Spec.APIServerPort != 0:
453454
apiServerPort = openStackCluster.Spec.APIServerPort
454-
} else {
455+
default:
455456
apiServerPort = 6443
456457
}
457458

@@ -471,21 +472,22 @@ func reconcileNetworkComponents(log logr.Logger, osProviderClient *gophercloud.P
471472
if !openStackCluster.Spec.ControlPlaneEndpoint.IsValid() {
472473
var host string
473474
// If there is a load balancer use the floating IP for it if set, falling back to the internal IP
474-
if openStackCluster.Spec.ManagedAPIServerLoadBalancer {
475+
switch {
476+
case openStackCluster.Spec.ManagedAPIServerLoadBalancer:
475477
if openStackCluster.Status.Network.APIServerLoadBalancer.IP != "" {
476478
host = openStackCluster.Status.Network.APIServerLoadBalancer.IP
477479
} else {
478480
host = openStackCluster.Status.Network.APIServerLoadBalancer.InternalIP
479481
}
480-
} else if !openStackCluster.Spec.DisableAPIServerFloatingIP {
482+
case !openStackCluster.Spec.DisableAPIServerFloatingIP:
481483
// If floating IPs are not disabled, get one to use as the VIP for the control plane
482484
fp, err := networkingService.GetOrCreateFloatingIP(openStackCluster, clusterName, openStackCluster.Spec.APIServerFloatingIP)
483485
if err != nil {
484486
handleUpdateOSCError(openStackCluster, errors.Errorf("Floating IP cannot be got or created: %v", err))
485487
return errors.Errorf("Floating IP cannot be got or created: %v", err)
486488
}
487489
host = fp.FloatingIP
488-
} else {
490+
default:
489491
// This case is not managed for now (i.e. no load balancer + no floating IP)
490492
// We could manage a VIP port on the cluster network and set allowedAddressPairs accordingly
491493
// when creating control plane machines, but this would require us to deploy software on the

0 commit comments

Comments
 (0)