@@ -31,6 +31,7 @@ import (
3131 "github.com/openshift/installer/pkg/rhcos"
3232 "github.com/openshift/installer/pkg/types"
3333 aztypes "github.com/openshift/installer/pkg/types/azure"
34+ "github.com/openshift/installer/pkg/types/dns"
3435)
3536
3637const (
@@ -64,6 +65,7 @@ type Provider struct {
6465 Tags map [string ]* string
6566 clientOptions * arm.ClientOptions
6667 computeClientOptions * arm.ClientOptions
68+ publicLBIP string
6769}
6870
6971var _ clusterapi.InfraReadyProvider = (* Provider )(nil )
@@ -436,7 +438,6 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
436438
437439 var lbBaps []* armnetwork.BackendAddressPool
438440 var extLBFQDN string
439- var pubIPAddress string
440441 if in .InstallConfig .Config .PublicAPI () {
441442 publicIP , err := createPublicIP (ctx , & pipInput {
442443 name : fmt .Sprintf ("%s-pip-v4" , in .InfraID ),
@@ -470,7 +471,7 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
470471 logrus .Debugf ("updated external load balancer: %s" , * loadBalancer .ID )
471472 lbBaps = loadBalancer .Properties .BackendAddressPools
472473 extLBFQDN = * publicIP .Properties .DNSSettings .Fqdn
473- pubIPAddress = * publicIP .Properties .IPAddress
474+ p . publicLBIP = * publicIP .Properties .IPAddress
474475 }
475476
476477 // Save context for other hooks
@@ -483,8 +484,10 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
483484 p .NetworkClientFactory = networkClientFactory
484485 p .lbBackendAddressPools = lbBaps
485486
486- if err := createDNSEntries (ctx , in , extLBFQDN , pubIPAddress , resourceGroupName , p .clientOptions ); err != nil {
487- return fmt .Errorf ("error creating DNS records: %w" , err )
487+ if in .InstallConfig .Config .Azure .UserProvisionedDNS != dns .UserProvisionedDNSEnabled {
488+ if err := createDNSEntries (ctx , in , extLBFQDN , p .publicLBIP , resourceGroupName , p .clientOptions ); err != nil {
489+ return fmt .Errorf ("error creating DNS records: %w" , err )
490+ }
488491 }
489492
490493 return nil
@@ -714,7 +717,6 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
714717 return nil , fmt .Errorf ("failed to get session: %w" , err )
715718 }
716719
717- bootstrapIgnData := in .BootstrapIgnData
718720 subscriptionID := session .Credentials .SubscriptionID
719721
720722 ignitionContainerName := "ignition"
@@ -739,6 +741,13 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
739741 logrus .Debugf ("BlobIgnitionContainer.ID=%s" , * blobIgnitionContainer .ID )
740742 }
741743
744+ // Edit Bootstrap, Master and Worker ignition files if needed. Currently, these
745+ // ignition files are updated only when userProvisionedDNS is enabled.
746+ ignOutput , err := editIgnition (ctx , in , p .publicLBIP )
747+ if err != nil {
748+ return nil , fmt .Errorf ("failed to edit bootstrap, master or worker ignition: %w" , err )
749+ }
750+
742751 sasURL := ""
743752
744753 if in .InstallConfig .Config .Azure .CustomerManagedKey == nil {
@@ -749,7 +758,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
749758 StorageAccountName : p .StorageAccountName ,
750759 StorageAccountKeys : p .StorageAccountKeys ,
751760 ClientOpts : p .clientOptions ,
752- BootstrapIgnData : bootstrapIgnData ,
761+ BootstrapIgnData : ignOutput . UpdatedBootstrapIgn ,
753762 CloudEnvironment : in .InstallConfig .Azure .CloudName ,
754763 ContainerName : ignitionContainerName ,
755764 BlobName : blobName ,
@@ -765,7 +774,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
765774 }
766775 } else {
767776 logrus .Debugf ("Creating a Page Blob for ignition shim because Customer Managed Key is provided" )
768- lengthBootstrapFile := int64 (len (bootstrapIgnData ))
777+ lengthBootstrapFile := int64 (len (ignOutput . UpdatedBootstrapIgn ))
769778 if lengthBootstrapFile % 512 != 0 {
770779 lengthBootstrapFile = (((lengthBootstrapFile / 512 ) + 1 ) * 512 )
771780 }
@@ -775,7 +784,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
775784 BlobURL : blobURL ,
776785 ImageURL : "" ,
777786 StorageAccountName : p .StorageAccountName ,
778- BootstrapIgnData : bootstrapIgnData ,
787+ BootstrapIgnData : ignOutput . UpdatedBootstrapIgn ,
779788 ImageLength : lengthBootstrapFile ,
780789 StorageAccountKeys : p .StorageAccountKeys ,
781790 ClientOpts : p .clientOptions ,
@@ -791,7 +800,8 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
791800
792801 ignSecrets := []* corev1.Secret {
793802 clusterapi .IgnitionSecret (ignShim , in .InfraID , "bootstrap" ),
794- clusterapi .IgnitionSecret (in .MasterIgnData , in .InfraID , "master" ),
803+ clusterapi .IgnitionSecret (ignOutput .UpdatedMasterIgn , in .InfraID , "master" ),
804+ clusterapi .IgnitionSecret (ignOutput .UpdatedWorkerIgn , in .InfraID , "worker" ),
795805 }
796806
797807 return ignSecrets , nil
0 commit comments