Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Cecile Robert-Michon committed Oct 2, 2020
1 parent 9d38ca0 commit a701fbb
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion api/v1alpha3/azurecluster_default.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
9 changes: 7 additions & 2 deletions cloud/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion cloud/scope/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
}
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion cloud/scope/machinepool.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}
Expand Down
2 changes: 1 addition & 1 deletion cloud/services/networkinterfaces/networkinterfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)),
},
}
}
Expand Down
6 changes: 0 additions & 6 deletions controllers/azurecluster_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit a701fbb

Please sign in to comment.