From a701fbbe8040e43c04c6bf678addc88b73f6ce1c Mon Sep 17 00:00:00 2001 From: Cecile Robert-Michon Date: Fri, 2 Oct 2020 16:29:55 -0700 Subject: [PATCH] fixes --- api/v1alpha3/azurecluster_default.go | 2 +- cloud/defaults.go | 9 +++++++-- cloud/scope/cluster.go | 3 ++- cloud/scope/machine.go | 2 +- cloud/scope/machinepool.go | 2 +- cloud/services/networkinterfaces/networkinterfaces.go | 2 +- controllers/azurecluster_controller.go | 6 ------ 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/v1alpha3/azurecluster_default.go b/api/v1alpha3/azurecluster_default.go index d7b13948c9f..a54c9425dcf 100644 --- a/api/v1alpha3/azurecluster_default.go +++ b/api/v1alpha3/azurecluster_default.go @@ -189,7 +189,7 @@ func generatePublicLBName(clusterName string) string { // generatePublicIPName generates a public IP name, based on the cluster name and a hash. func generatePublicIPName(clusterName string) string { - return fmt.Sprintf("pip-apiserver-%s", clusterName) + return fmt.Sprintf("pip-%s-apiserver", clusterName) } // generateFrontendIPConfigName generates a load balancer frontend IP config name. diff --git a/cloud/defaults.go b/cloud/defaults.go index a5eba9395fe..1777aa9e12b 100644 --- a/cloud/defaults.go +++ b/cloud/defaults.go @@ -51,11 +51,16 @@ func GenerateBackendAddressPoolName(lbName string) string { return fmt.Sprintf("%s-%s", lbName, "backendPool") } -// GenerateOutboundBackendddressPoolName generates a load balancer outbound backend address pool name. -func GenerateOutboundBackendddressPoolName(lbName string) string { +// GenerateOutboundBackendAddressPoolName generates a load balancer outbound backend address pool name. +func GenerateOutboundBackendAddressPoolName(lbName string) string { return fmt.Sprintf("%s-%s", lbName, "outboundBackendPool") } +// GenerateFrontendIPConfigName generates a load balancer frontend IP config name. +func GenerateFrontendIPConfigName(lbName string) string { + return fmt.Sprintf("%s-%s", lbName, "frontEnd") +} + // GenerateNodeOutboundIPName generates a public IP name, based on the cluster name. func GenerateNodeOutboundIPName(clusterName string) string { return fmt.Sprintf("pip-%s-node-outbound", clusterName) diff --git a/cloud/scope/cluster.go b/cloud/scope/cluster.go index 5b174d1231e..1fdd937c013 100644 --- a/cloud/scope/cluster.go +++ b/cloud/scope/cluster.go @@ -138,13 +138,14 @@ func (s *ClusterScope) LBSpecs() []azure.LBSpec { Name: s.NodeOutboundLBName(), FrontendIPConfigs: []infrav1.FrontendIP{ { + Name: azure.GenerateFrontendIPConfigName(s.NodeOutboundLBName()), PublicIP: &infrav1.PublicIPSpec{ Name: azure.GenerateNodeOutboundIPName(s.NodeOutboundLBName()), }, }, }, Type: infrav1.Public, - BackendPoolName: azure.GenerateOutboundBackendddressPoolName(s.NodeOutboundLBName()), + BackendPoolName: azure.GenerateOutboundBackendAddressPoolName(s.NodeOutboundLBName()), Role: infrav1.NodeOutboundRole, }, } diff --git a/cloud/scope/machine.go b/cloud/scope/machine.go index 7b5092bccf6..f5e975976fe 100644 --- a/cloud/scope/machine.go +++ b/cloud/scope/machine.go @@ -159,7 +159,7 @@ func (m *MachineScope) NICSpecs() []azure.NICSpec { spec.LBNATRuleName = m.Name() } else if m.Role() == infrav1.Node { spec.LBName = m.NodeOutboundLBName() - spec.LBBackendAddressPoolName = azure.GenerateOutboundBackendddressPoolName(m.NodeOutboundLBName()) + spec.LBBackendAddressPoolName = azure.GenerateOutboundBackendAddressPoolName(m.NodeOutboundLBName()) } specs := []azure.NICSpec{spec} if m.AzureMachine.Spec.AllocatePublicIP == true { diff --git a/cloud/scope/machinepool.go b/cloud/scope/machinepool.go index 399f73a495c..86c6c9f8b3e 100644 --- a/cloud/scope/machinepool.go +++ b/cloud/scope/machinepool.go @@ -103,7 +103,7 @@ func (m *MachinePoolScope) ScaleSetSpec() azure.ScaleSetSpec { VNetName: m.Vnet().Name, VNetResourceGroup: m.Vnet().ResourceGroup, PublicLBName: m.NodeOutboundLBName(), - PublicLBAddressPoolName: azure.GenerateOutboundBackendddressPoolName(m.NodeOutboundLBName()), + PublicLBAddressPoolName: azure.GenerateOutboundBackendAddressPoolName(m.NodeOutboundLBName()), AcceleratedNetworking: m.AzureMachinePool.Spec.Template.AcceleratedNetworking, } } diff --git a/cloud/services/networkinterfaces/networkinterfaces.go b/cloud/services/networkinterfaces/networkinterfaces.go index a2d95475910..734c8bc1c2c 100644 --- a/cloud/services/networkinterfaces/networkinterfaces.go +++ b/cloud/services/networkinterfaces/networkinterfaces.go @@ -62,7 +62,7 @@ func (s *Service) Reconcile(ctx context.Context) error { if nicSpec.LBNATRuleName != "" { nicConfig.LoadBalancerInboundNatRules = &[]network.InboundNatRule{ { - ID: to.StringPtr(azure.NATRuleID(s.Scope.SubscriptionID(), s.Scope.ResourceGroup(), nicSpec.LBName, nicSpec.LBBackendAddressPoolName)), + ID: to.StringPtr(azure.NATRuleID(s.Scope.SubscriptionID(), s.Scope.ResourceGroup(), nicSpec.LBName, nicSpec.LBNATRuleName)), }, } } diff --git a/controllers/azurecluster_controller.go b/controllers/azurecluster_controller.go index faa2809167a..6e728250d5c 100644 --- a/controllers/azurecluster_controller.go +++ b/controllers/azurecluster_controller.go @@ -201,12 +201,6 @@ func (r *AzureClusterReconciler) reconcileNormal(ctx context.Context, clusterSco return reconcile.Result{}, wrappedErr } - if clusterScope.APIServerLB().ID == "" { - clusterScope.Info("Waiting for Load Balancer to exist") - conditions.MarkFalse(azureCluster, infrav1.NetworkInfrastructureReadyCondition, infrav1.LoadBalancerProvisioningReason, clusterv1.ConditionSeverityWarning, err.Error()) - return reconcile.Result{RequeueAfter: 15 * time.Second}, nil - } - // Set APIEndpoints so the Cluster API Cluster Controller can pull them azureCluster.Spec.ControlPlaneEndpoint = clusterv1.APIEndpoint{ Host: clusterScope.APIServerHost(),