@@ -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 )
@@ -471,6 +473,7 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
471473 lbBaps = loadBalancer .Properties .BackendAddressPools
472474 extLBFQDN = * publicIP .Properties .DNSSettings .Fqdn
473475 pubIPAddress = * publicIP .Properties .IPAddress
476+ p .publicLBIP = pubIPAddress
474477 }
475478
476479 // Save context for other hooks
@@ -483,8 +486,10 @@ func (p *Provider) InfraReady(ctx context.Context, in clusterapi.InfraReadyInput
483486 p .NetworkClientFactory = networkClientFactory
484487 p .lbBackendAddressPools = lbBaps
485488
486- if err := createDNSEntries (ctx , in , extLBFQDN , pubIPAddress , resourceGroupName , p .clientOptions ); err != nil {
487- return fmt .Errorf ("error creating DNS records: %w" , err )
489+ if in .InstallConfig .Config .Azure .UserProvisionedDNS != dns .UserProvisionedDNSEnabled {
490+ if err := createDNSEntries (ctx , in , extLBFQDN , pubIPAddress , resourceGroupName , p .clientOptions ); err != nil {
491+ return fmt .Errorf ("error creating DNS records: %w" , err )
492+ }
488493 }
489494
490495 return nil
@@ -714,7 +719,6 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
714719 return nil , fmt .Errorf ("failed to get session: %w" , err )
715720 }
716721
717- bootstrapIgnData := in .BootstrapIgnData
718722 subscriptionID := session .Credentials .SubscriptionID
719723
720724 ignitionContainerName := "ignition"
@@ -739,6 +743,13 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
739743 logrus .Debugf ("BlobIgnitionContainer.ID=%s" , * blobIgnitionContainer .ID )
740744 }
741745
746+ // Edit Bootstrap, Master and Worker ignition files if needed. Currently, these
747+ // ignition files are updated only when userProvisionedDNS is enabled.
748+ ignOutput , err := editIgnition (ctx , in , p .publicLBIP )
749+ if err != nil {
750+ return nil , fmt .Errorf ("failed to edit bootstrap, master or worker ignition: %w" , err )
751+ }
752+
742753 sasURL := ""
743754
744755 if in .InstallConfig .Config .Azure .CustomerManagedKey == nil {
@@ -749,7 +760,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
749760 StorageAccountName : p .StorageAccountName ,
750761 StorageAccountKeys : p .StorageAccountKeys ,
751762 ClientOpts : p .clientOptions ,
752- BootstrapIgnData : bootstrapIgnData ,
763+ BootstrapIgnData : ignOutput . UpdatedBootstrapIgn ,
753764 CloudEnvironment : in .InstallConfig .Azure .CloudName ,
754765 ContainerName : ignitionContainerName ,
755766 BlobName : blobName ,
@@ -765,7 +776,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
765776 }
766777 } else {
767778 logrus .Debugf ("Creating a Page Blob for ignition shim because Customer Managed Key is provided" )
768- lengthBootstrapFile := int64 (len (bootstrapIgnData ))
779+ lengthBootstrapFile := int64 (len (ignOutput . UpdatedBootstrapIgn ))
769780 if lengthBootstrapFile % 512 != 0 {
770781 lengthBootstrapFile = (((lengthBootstrapFile / 512 ) + 1 ) * 512 )
771782 }
@@ -775,7 +786,7 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
775786 BlobURL : blobURL ,
776787 ImageURL : "" ,
777788 StorageAccountName : p .StorageAccountName ,
778- BootstrapIgnData : bootstrapIgnData ,
789+ BootstrapIgnData : ignOutput . UpdatedBootstrapIgn ,
779790 ImageLength : lengthBootstrapFile ,
780791 StorageAccountKeys : p .StorageAccountKeys ,
781792 ClientOpts : p .clientOptions ,
@@ -791,7 +802,8 @@ func (p Provider) Ignition(ctx context.Context, in clusterapi.IgnitionInput) ([]
791802
792803 ignSecrets := []* corev1.Secret {
793804 clusterapi .IgnitionSecret (ignShim , in .InfraID , "bootstrap" ),
794- clusterapi .IgnitionSecret (in .MasterIgnData , in .InfraID , "master" ),
805+ clusterapi .IgnitionSecret (ignOutput .UpdatedMasterIgn , in .InfraID , "master" ),
806+ clusterapi .IgnitionSecret (ignOutput .UpdatedWorkerIgn , in .InfraID , "worker" ),
795807 }
796808
797809 return ignSecrets , nil
0 commit comments