@@ -325,7 +325,7 @@ func (i *InfraProvider) Provision(ctx context.Context, dir string, parents asset
325325 {
326326 untilTime := time .Now ().Add (provisionTimeout )
327327 timezone , _ := untilTime .Zone ()
328- reqBootstrapPubIP := installConfig .Config .Publish == types .ExternalPublishingStrategy && i .impl .BootstrapHasPublicIP ()
328+ reqBootstrapPubIP := installConfig .Config .Publish == types .ExternalPublishingStrategy && i .impl .PublicGatherEndpoint () == ExternalIP
329329 logrus .Infof ("Waiting up to %v (until %v %s) for machines %v to provision..." , provisionTimeout , untilTime .Format (time .Kitchen ), timezone , machineNames )
330330 if err := wait .PollUntilContextTimeout (ctx , 15 * time .Second , provisionTimeout , true ,
331331 func (ctx context.Context ) (bool , error ) {
@@ -504,22 +504,12 @@ func (i *InfraProvider) ExtractHostAddresses(dir string, config *types.InstallCo
504504 manifestsDir := filepath .Join (dir , clusterapi .ArtifactsDir )
505505 logrus .Debugf ("Looking for machine manifests in %s" , manifestsDir )
506506
507- bootstrapFiles , err := filepath .Glob (filepath .Join (manifestsDir , "Machine\\ -openshift\\ -cluster\\ -api\\ -guests\\ -*\\ -bootstrap.yaml" ))
508- if err != nil {
509- return fmt .Errorf ("failed to list bootstrap manifests: %w" , err )
510- }
511- logrus .Debugf ("bootstrap manifests found: %v" , bootstrapFiles )
512-
513- if len (bootstrapFiles ) != 1 {
514- return fmt .Errorf ("wrong number of bootstrap manifests found: %v. Expected exactly one" , bootstrapFiles )
515- }
516- addrs , err := extractIPAddress (bootstrapFiles [0 ])
507+ addr , err := i .getBootstrapAddress (config , manifestsDir )
517508 if err != nil {
518- return fmt .Errorf ("failed to extract IP address for bootstrap : %w" , err )
509+ return fmt .Errorf ("failed to get bootstrap address: %w" , err )
519510 }
520- logrus . Debugf ( "found bootstrap address: %s" , addrs )
511+ ha . Bootstrap = addr
521512
522- ha .Bootstrap = prioritizeIPv4 (config , addrs )
523513 masterFiles , err := filepath .Glob (filepath .Join (manifestsDir , "Machine\\ -openshift\\ -cluster\\ -api\\ -guests\\ -*\\ -master\\ -?.yaml" ))
524514 if err != nil {
525515 return fmt .Errorf ("failed to list master machine manifests: %w" , err )
@@ -544,6 +534,30 @@ func (i *InfraProvider) ExtractHostAddresses(dir string, config *types.InstallCo
544534 return nil
545535}
546536
537+ func (i * InfraProvider ) getBootstrapAddress (config * types.InstallConfig , manifestsDir string ) (string , error ) {
538+ // If the bootstrap node cannot have a public IP address, we
539+ // SSH through the load balancer, as is this case on Azure.
540+ if i .impl .PublicGatherEndpoint () == APILoadBalancer && config .Publish != types .InternalPublishingStrategy {
541+ return fmt .Sprintf ("api.%s" , config .ClusterDomain ()), nil
542+ }
543+
544+ bootstrapFiles , err := filepath .Glob (filepath .Join (manifestsDir , "Machine\\ -openshift\\ -cluster\\ -api\\ -guests\\ -*\\ -bootstrap.yaml" ))
545+ if err != nil {
546+ return "" , fmt .Errorf ("failed to list bootstrap manifests: %w" , err )
547+ }
548+ logrus .Debugf ("bootstrap manifests found: %v" , bootstrapFiles )
549+
550+ if len (bootstrapFiles ) != 1 {
551+ return "" , fmt .Errorf ("wrong number of bootstrap manifests found: %v. Expected exactly one" , bootstrapFiles )
552+ }
553+ addrs , err := extractIPAddress (bootstrapFiles [0 ])
554+ if err != nil {
555+ return "" , fmt .Errorf ("failed to extract IP address for bootstrap: %w" , err )
556+ }
557+ logrus .Debugf ("found bootstrap address: %s" , addrs )
558+ return prioritizeIPv4 (config , addrs ), nil
559+ }
560+
547561// IgnitionSecret provides the basic formatting for creating the
548562// ignition secret.
549563func IgnitionSecret (ign []byte , infraID , role string ) * corev1.Secret {
0 commit comments