Skip to content

Commit f5b7b71

Browse files
committed
DNM: Test only
Used to test different solutions for AWS, Azure custom-dns performance based errors.
1 parent 435db5e commit f5b7b71

File tree

1 file changed

+17
-13
lines changed

1 file changed

+17
-13
lines changed

cmd/openshift-install/create.go

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,8 @@ func clusterCreatePostRun(ctx context.Context) (int, error) {
153153
}
154154

155155
// Handle the case when the API server is not reachable.
156-
if err := handleUnreachableAPIServer(ctx, config); err != nil {
156+
apiLBIP, err := handleUnreachableAPIServer(ctx, config)
157+
if err != nil {
157158
logrus.Fatal(fmt.Errorf("unable to handle api server override: %w", err))
158159
}
159160

@@ -220,6 +221,9 @@ func clusterCreatePostRun(ctx context.Context) (int, error) {
220221
logrus.Error(err)
221222
return command.ExitCodeInstallFailed, nil
222223
}
224+
if apiLBIP != "" {
225+
logrus.Infof("Please setup your external LB with API URL pointing to %s", apiLBIP)
226+
}
223227
timer.StopTimer(timer.TotalTimeElapsed)
224228
timer.LogSummary()
225229
return 0, nil
@@ -501,37 +505,37 @@ func waitForEtcdBootstrapMemberRemoval(ctx context.Context, config *rest.Config)
501505
return nil
502506
}
503507

504-
func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error {
508+
func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) (string, error) {
505509
assetStore, err := assetstore.NewStore(command.RootOpts.Dir)
506510
if err != nil {
507-
return fmt.Errorf("failed to create asset store: %w", err)
511+
return "", fmt.Errorf("failed to create asset store: %w", err)
508512
}
509513

510514
// Ensure that the install is expecting the user to provision their own DNS solution.
511515
installConfig := &installconfig.InstallConfig{}
512516
if err := assetStore.Fetch(ctx, installConfig); err != nil {
513-
return fmt.Errorf("failed to fetch %s: %w", installConfig.Name(), err)
517+
return "", fmt.Errorf("failed to fetch %s: %w", installConfig.Name(), err)
514518
}
515519
switch installConfig.Config.Platform.Name() { //nolint:gocritic
516520
case aws.Name:
517521
if installConfig.Config.AWS.UserProvisionedDNS != dns.UserProvisionedDNSEnabled {
518-
return nil
522+
return "", nil
519523
}
520524
case azure.Name:
521525
if installConfig.Config.Azure.UserProvisionedDNS != dns.UserProvisionedDNSEnabled {
522-
return nil
526+
return "", nil
523527
}
524528
case gcp.Name:
525529
if installConfig.Config.GCP.UserProvisionedDNS != dns.UserProvisionedDNSEnabled {
526-
return nil
530+
return "", nil
527531
}
528532
default:
529-
return nil
533+
return "", nil
530534
}
531535

532536
lbConfig := &lbconfig.Config{}
533537
if err := assetStore.Fetch(ctx, lbConfig); err != nil {
534-
return fmt.Errorf("failed to fetch %s: %w", lbConfig.Name(), err)
538+
return "", fmt.Errorf("failed to fetch %s: %w", lbConfig.Name(), err)
535539
}
536540

537541
lbType := lbconfig.PublicLoadBalancer
@@ -541,7 +545,7 @@ func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error
541545

542546
_, ipAddrs, err := lbConfig.ParseDNSDataFromConfig(lbType)
543547
if err != nil {
544-
return fmt.Errorf("failed to parse lbconfig: %w", err)
548+
return "", fmt.Errorf("failed to parse lbconfig: %w", err)
545549
}
546550

547551
// The kubeconfig handles one ip address
@@ -550,7 +554,7 @@ func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error
550554
ipAddr = ipAddrs[0].String()
551555
}
552556
if ipAddr == "" {
553-
return fmt.Errorf("no ip address found in lbconfig")
557+
return "", fmt.Errorf("no ip address found in lbconfig")
554558
}
555559

556560
dialer := &net.Dialer{
@@ -563,8 +567,8 @@ func handleUnreachableAPIServer(ctx context.Context, config *rest.Config) error
563567
// was consumed during install but this file is generated after that action. This
564568
// artifact will hang around unless it is purged here.
565569
if err := asset.DeleteAssetFromDisk(lbConfig, command.RootOpts.Dir); err != nil {
566-
return fmt.Errorf("failed to delete %s from disk", lbConfig.Name())
570+
return ipAddr, fmt.Errorf("failed to delete %s from disk", lbConfig.Name())
567571
}
568572

569-
return nil
573+
return ipAddr, nil
570574
}

0 commit comments

Comments
 (0)