59
59
COLOR_RESET = "\033 [0m"
60
60
UNDERLINE_RESET = "\033 [24m"
61
61
BOLD_RESET = "\033 [22m"
62
+
63
+ errUserCanceledInsecureInstall = fmt .Errorf ("cancelled installation due to invalid ingress host certificate" )
62
64
)
63
65
64
66
func postInitCommands (commands []* cobra.Command ) {
@@ -473,12 +475,12 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
473
475
log .G (ctx ).Info ("Retrieving ingress controller info from your cluster...\n " )
474
476
475
477
cs := opts .KubeFactory .KubernetesClientSetOrDie ()
476
- ServicesList , err := cs .CoreV1 ().Services ("" ).List (ctx , metav1.ListOptions {})
478
+ servicesList , err := cs .CoreV1 ().Services ("" ).List (ctx , metav1.ListOptions {})
477
479
if err != nil {
478
480
return fmt .Errorf ("failed to get ingress controller info from your cluster: %w" , err )
479
481
}
480
482
481
- for _ , s := range ServicesList .Items {
483
+ for _ , s := range servicesList .Items {
482
484
if s .ObjectMeta .Name == opts .IngressController .Name () && s .Spec .Type == "LoadBalancer" {
483
485
if len (s .Status .LoadBalancer .Ingress ) > 0 {
484
486
ingress := s .Status .LoadBalancer .Ingress [0 ]
@@ -498,25 +500,15 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
498
500
}
499
501
500
502
if store .Get ().Silent {
503
+ if foundIngressHost == "" {
504
+ return fmt .Errorf ("please provide an ingress host via --ingress-host or installation wizard" )
505
+ }
501
506
opts .IngressHost = foundIngressHost
502
507
} else {
503
508
opts .IngressHost , err = getIngressHostFromUserInput (foundIngressHost )
504
- if err != nil {
505
- return err
506
- }
507
- response , err := http .Get (opts .IngressHost )
508
- if err != nil {
509
- opts .IngressHost = ""
510
- return err
511
- }
512
- response .Body .Close ()
513
- }
514
-
515
- if opts .IngressHost == "" {
516
- return fmt .Errorf ("please provide an ingress host via --ingress-host or installation wizard" )
517
509
}
518
510
519
- return nil
511
+ return err
520
512
}
521
513
522
514
func getIngressHostFromUserInput (foundIngressHost string ) (string , error ) {
@@ -616,7 +608,7 @@ func askUserIfToProceedWithInsecure(ctx context.Context) error {
616
608
if result == "Yes" {
617
609
store .Get ().InsecureIngressHost = true
618
610
} else {
619
- return fmt . Errorf ( "cancelled installation due to invalid ingress host certificate" )
611
+ return errUserCanceledInsecureInstall
620
612
}
621
613
622
614
return nil
@@ -635,7 +627,9 @@ func handleValidationFailsWithRepeat(callback Callback) {
635
627
}
636
628
637
629
func isValidationError (err error ) bool {
638
- return err != nil && err != promptui .ErrInterrupt
630
+ return err != nil &&
631
+ err != promptui .ErrInterrupt &&
632
+ err != errUserCanceledInsecureInstall
639
633
}
640
634
641
635
func getIscRepo (ctx context.Context ) (string , error ) {
0 commit comments