5959 COLOR_RESET = "\033 [0m"
6060 UNDERLINE_RESET = "\033 [24m"
6161 BOLD_RESET = "\033 [22m"
62+
63+ errUserCanceledInsecureInstall = fmt .Errorf ("cancelled installation due to invalid ingress host certificate" )
6264)
6365
6466func postInitCommands (commands []* cobra.Command ) {
@@ -473,12 +475,12 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
473475 log .G (ctx ).Info ("Retrieving ingress controller info from your cluster...\n " )
474476
475477 cs := opts .KubeFactory .KubernetesClientSetOrDie ()
476- ServicesList , err := cs .CoreV1 ().Services ("" ).List (ctx , metav1.ListOptions {})
478+ servicesList , err := cs .CoreV1 ().Services ("" ).List (ctx , metav1.ListOptions {})
477479 if err != nil {
478480 return fmt .Errorf ("failed to get ingress controller info from your cluster: %w" , err )
479481 }
480482
481- for _ , s := range ServicesList .Items {
483+ for _ , s := range servicesList .Items {
482484 if s .ObjectMeta .Name == opts .IngressController .Name () && s .Spec .Type == "LoadBalancer" {
483485 if len (s .Status .LoadBalancer .Ingress ) > 0 {
484486 ingress := s .Status .LoadBalancer .Ingress [0 ]
@@ -498,25 +500,15 @@ func setIngressHost(ctx context.Context, opts *RuntimeInstallOptions) error {
498500 }
499501
500502 if store .Get ().Silent {
503+ if foundIngressHost == "" {
504+ return fmt .Errorf ("please provide an ingress host via --ingress-host or installation wizard" )
505+ }
501506 opts .IngressHost = foundIngressHost
502507 } else {
503508 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" )
517509 }
518510
519- return nil
511+ return err
520512}
521513
522514func getIngressHostFromUserInput (foundIngressHost string ) (string , error ) {
@@ -616,7 +608,7 @@ func askUserIfToProceedWithInsecure(ctx context.Context) error {
616608 if result == "Yes" {
617609 store .Get ().InsecureIngressHost = true
618610 } else {
619- return fmt . Errorf ( "cancelled installation due to invalid ingress host certificate" )
611+ return errUserCanceledInsecureInstall
620612 }
621613
622614 return nil
@@ -635,7 +627,9 @@ func handleValidationFailsWithRepeat(callback Callback) {
635627}
636628
637629func isValidationError (err error ) bool {
638- return err != nil && err != promptui .ErrInterrupt
630+ return err != nil &&
631+ err != promptui .ErrInterrupt &&
632+ err != errUserCanceledInsecureInstall
639633}
640634
641635func getIscRepo (ctx context.Context ) (string , error ) {
0 commit comments