@@ -448,9 +448,14 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
448448 var extLBFQDN string
449449 if in .InstallConfig .Config .PublicAPI () {
450450 var publicIPv6 * armnetwork.PublicIPAddress
451+ v4InfraID := in .InfraID
452+ v6InfraID := ""
453+ if in .InstallConfig .Config .Azure .IPFamily .DualStackEnabled () {
454+ v6InfraID = fmt .Sprintf ("%s-v6" , in .InfraID )
455+ }
451456 publicIP , err := createPublicIP (ctx , & pipInput {
452457 name : fmt .Sprintf ("%s-pip-v4" , in .InfraID ),
453- infraID : in . InfraID ,
458+ infraID : v4InfraID ,
454459 region : in .InstallConfig .Config .Azure .Region ,
455460 resourceGroup : resourceGroupName ,
456461 pipClient : networkClientFactory .NewPublicIPAddressesClient (),
@@ -464,7 +469,7 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
464469 if in .InstallConfig .Config .Azure .IPFamily .DualStackEnabled () {
465470 publicIPv6 , err = createPublicIP (ctx , & pipInput {
466471 name : fmt .Sprintf ("%s-pip-v6" , in .InfraID ),
467- infraID : in . InfraID ,
472+ infraID : v6InfraID ,
468473 region : in .InstallConfig .Config .Azure .Region ,
469474 resourceGroup : resourceGroupName ,
470475 pipClient : networkClientFactory .NewPublicIPAddressesClient (),
@@ -585,6 +590,36 @@ func (p *Provider) PostProvision(ctx context.Context, in clusterapi.PostProvisio
585590 return fmt .Errorf ("failed to associate control plane VMs with external load balancer: %w" , err )
586591 }
587592
593+ if in .InstallConfig .Config .Azure .IPFamily .DualStackEnabled () {
594+ bootstrapNicName := fmt .Sprintf ("%s-bootstrap-nic" , in .InfraID )
595+ nicClient := p .NetworkClientFactory .NewInterfacesClient ()
596+ bootstrapNic , err := nicClient .Get (ctx , p .ResourceGroupName , bootstrapNicName , nil )
597+ if err != nil {
598+ return fmt .Errorf ("failed to get bootstrap nic: %w" , err )
599+ }
600+ for _ , ipconfig := range bootstrapNic .Properties .IPConfigurations {
601+ if ipconfig .Properties .PrivateIPAddressVersion != nil && * ipconfig .Properties .PrivateIPAddressVersion == armnetwork .IPVersionIPv6 {
602+ for _ , pool := range p .lbBackendAddressPools {
603+ if pool .Name != nil && strings .HasSuffix (* pool .Name , "-v6" ) {
604+ ipconfig .Properties .LoadBalancerBackendAddressPools = append (
605+ ipconfig .Properties .LoadBalancerBackendAddressPools ,
606+ pool ,
607+ )
608+ }
609+ }
610+ }
611+ }
612+ pollerResp , err := nicClient .BeginCreateOrUpdate (ctx , p .ResourceGroupName , bootstrapNicName , bootstrapNic .Interface , nil )
613+ if err != nil {
614+ return fmt .Errorf ("failed to update bootstrap nic with IPv6 backend pools: %w" , err )
615+ }
616+ _ , err = pollerResp .PollUntilDone (ctx , nil )
617+ if err != nil {
618+ return fmt .Errorf ("failed to update bootstrap nic with IPv6 backend pools: %w" , err )
619+ }
620+ logrus .Debugf ("associated bootstrap NIC with IPv6 backend pools" )
621+ }
622+
588623 sshRuleName := fmt .Sprintf ("%s_ssh_in" , in .InfraID )
589624
590625 loadBalancerName := in .InfraID
@@ -630,27 +665,6 @@ func (p *Provider) PostProvision(ctx context.Context, in clusterapi.PostProvisio
630665
631666 // For dual-stack, create IPv6 inbound rule for SSH access to bootstrap.
632667 if in .InstallConfig .Config .Azure .IPFamily .DualStackEnabled () {
633- publicIPv6outbound , err := createPublicIP (ctx , & pipInput {
634- name : fmt .Sprintf ("%s-pip-v6-outbound-lb" , in .InfraID ),
635- infraID : in .InfraID ,
636- region : in .InstallConfig .Config .Azure .Region ,
637- resourceGroup : p .ResourceGroupName ,
638- pipClient : p .NetworkClientFactory .NewPublicIPAddressesClient (),
639- tags : p .Tags ,
640- ipversion : armnetwork .IPVersionIPv6 ,
641- })
642- if err != nil {
643- return fmt .Errorf ("failed to create public ipv6 for outbound ipv6 lb: %w" , err )
644- }
645- logrus .Debugf ("created public ipv6 for outbound ipv6 lb: %s" , * publicIPv6outbound .ID )
646-
647- // Update the outbound node IPv6 load balancer.
648- outboundLBName := fmt .Sprintf ("%s-ipv6-outbound-node-lb" , in .InfraID )
649- err = updateOutboundIPv6LoadBalancer (ctx , publicIPv6outbound , p .NetworkClientFactory .NewLoadBalancersClient (), p .ResourceGroupName , outboundLBName , in .InfraID )
650- if err != nil {
651- return fmt .Errorf ("failed to set public ipv6 to outbound ipv6 lb: %w" , err )
652- }
653- logrus .Debugf ("updated outbound ipv6 lb %s with public ipv6: %s" , outboundLBName , * publicIPv6outbound .ID )
654668 frontendIPv6ConfigName := "public-lb-ip-v6"
655669 sshRuleNameV6 := fmt .Sprintf ("%s_ssh_in_v6" , in .InfraID )
656670 frontendIPv6ConfigID := fmt .Sprintf ("/subscriptions/%s/resourceGroups/%s/providers/Microsoft.Network/loadBalancers/%s/frontendIPConfigurations/%s" ,
0 commit comments