88 "encoding/pem"
99 "fmt"
1010 gherrors "github.com/pkg/errors"
11+ "io"
1112 "os"
1213 "reflect"
1314 "strings"
@@ -395,26 +396,30 @@ func (o *Options) applyKlusterlet(r *reader.ResourceReader, operatorClient opera
395396 }
396397
397398 if ! o .ClusteradmFlags .DryRun {
398- if err := wait .WaitUntilCRDReady (apiExtensionsClient , "klusterlets.operator.open-cluster-management.io" , o .wait ); err != nil {
399+ if err := wait .WaitUntilCRDReady (
400+ o .Streams .Out , apiExtensionsClient , "klusterlets.operator.open-cluster-management.io" , o .wait ); err != nil {
399401 return err
400402 }
401403 }
402404
403405 if ! available && o .wait && ! o .ClusteradmFlags .DryRun {
404- err = waitUntilRegistrationOperatorConditionIsTrue (o .ClusteradmFlags .KubectlFactory , int64 (o .ClusteradmFlags .Timeout ))
406+ err = waitUntilRegistrationOperatorConditionIsTrue (
407+ o .Streams .Out , o .ClusteradmFlags .KubectlFactory , int64 (o .ClusteradmFlags .Timeout ))
405408 if err != nil {
406409 return err
407410 }
408411 }
409412
410413 if o .wait && ! o .ClusteradmFlags .DryRun {
411414 if o .mode == string (operatorv1 .InstallModeHosted ) {
412- err = waitUntilKlusterletConditionIsTrue (operatorClient , int64 (o .ClusteradmFlags .Timeout ), o .klusterletChartConfig .Klusterlet .Name )
415+ err = waitUntilKlusterletConditionIsTrue (
416+ o .Streams .Out , operatorClient , int64 (o .ClusteradmFlags .Timeout ), o .klusterletChartConfig .Klusterlet .Name )
413417 if err != nil {
414418 return err
415419 }
416420 } else {
417- err = waitUntilKlusterletConditionIsTrue (operatorClient , int64 (o .ClusteradmFlags .Timeout ), o .klusterletChartConfig .Klusterlet .Name )
421+ err = waitUntilKlusterletConditionIsTrue (
422+ o .Streams .Out , operatorClient , int64 (o .ClusteradmFlags .Timeout ), o .klusterletChartConfig .Klusterlet .Name )
418423 if err != nil {
419424 return err
420425 }
@@ -475,6 +480,7 @@ func (o *Options) waitUntilManagedClusterIsCreated(timeout int64, clusterName st
475480 phase := & atomic.Value {}
476481 phase .Store ("" )
477482 operatorSpinner := printer .NewSpinnerWithStatus (
483+ o .Streams .Out ,
478484 "Waiting for managed cluster to be created..." ,
479485 time .Millisecond * 500 ,
480486 "Managed cluster is created.\n " ,
@@ -505,7 +511,7 @@ func (o *Options) waitUntilManagedClusterIsCreated(timeout int64, clusterName st
505511 })
506512}
507513
508- func waitUntilRegistrationOperatorConditionIsTrue (f util.Factory , timeout int64 ) error {
514+ func waitUntilRegistrationOperatorConditionIsTrue (w io. Writer , f util.Factory , timeout int64 ) error {
509515 var restConfig * rest.Config
510516 restConfig , err := f .ToRESTConfig ()
511517 if err != nil {
@@ -519,6 +525,7 @@ func waitUntilRegistrationOperatorConditionIsTrue(f util.Factory, timeout int64)
519525 phase := & atomic.Value {}
520526 phase .Store ("" )
521527 operatorSpinner := printer .NewSpinnerWithStatus (
528+ w ,
522529 "Waiting for registration operator to become ready..." ,
523530 time .Millisecond * 500 ,
524531 "Registration operator is now available.\n " ,
@@ -556,10 +563,12 @@ func waitUntilRegistrationOperatorConditionIsTrue(f util.Factory, timeout int64)
556563}
557564
558565// Wait until the klusterlet condition available=true, or timeout in $timeout seconds
559- func waitUntilKlusterletConditionIsTrue (client operatorclient.Interface , timeout int64 , klusterletName string ) error {
566+ func waitUntilKlusterletConditionIsTrue (
567+ w io.Writer , client operatorclient.Interface , timeout int64 , klusterletName string ) error {
560568 phase := & atomic.Value {}
561569 phase .Store ("" )
562570 klusterletSpinner := printer .NewSpinnerWithStatus (
571+ w ,
563572 "Waiting for klusterlet agent to become ready..." ,
564573 time .Millisecond * 500 ,
565574 "Klusterlet is now available.\n " ,
0 commit comments