@@ -161,8 +161,11 @@ type ObjectGeneratorOptions struct {
161161}
162162
163163type AppOptions struct {
164- genericclioptions.IOStreams
165164 * ObjectGeneratorOptions
165+
166+ RESTClientGetter genericclioptions.RESTClientGetter
167+
168+ genericclioptions.IOStreams
166169}
167170
168171type versionedPrintObj struct {
@@ -367,6 +370,8 @@ func NewCmdNewApplication(name, baseName string, f kcmdutil.Factory, streams gen
367370
368371// Complete sets any default behavior for the command
369372func (o * AppOptions ) Complete (baseName , commandName string , f kcmdutil.Factory , c * cobra.Command , args []string ) error {
373+ o .RESTClientGetter = f
374+
370375 cmdutil .WarnAboutCommaSeparation (o .ErrOut , o .ObjectGeneratorOptions .Config .TemplateParameters , "--param" )
371376 err := o .ObjectGeneratorOptions .Complete (baseName , commandName , f , c , args )
372377 if err != nil {
@@ -510,7 +515,7 @@ func (o *AppOptions) RunNewApp() error {
510515
511516 switch {
512517 case len (installing ) == 1 :
513- return followInstallation (config , installing [0 ], o .LogsForObject )
518+ return followInstallation (config , o . RESTClientGetter , installing [0 ], o .LogsForObject )
514519 case len (installing ) > 1 :
515520 for i := range installing {
516521 fmt .Fprintf (out , "%sTrack installation of %s with '%s logs %s'.\n " , indent , installing [i ].Name , o .BaseName , installing [i ].Name )
@@ -554,7 +559,7 @@ func getServices(items []runtime.Object) []*corev1.Service {
554559 return svc
555560}
556561
557- func followInstallation (config * newcmd.AppConfig , pod * corev1.Pod , logsForObjectFn polymorphichelpers.LogsForObjectFunc ) error {
562+ func followInstallation (config * newcmd.AppConfig , clientGetter genericclioptions. RESTClientGetter , pod * corev1.Pod , logsForObjectFn polymorphichelpers.LogsForObjectFunc ) error {
558563 fmt .Fprintf (config .Out , "--> Installing ...\n " )
559564
560565 // we cannot retrieve logs until the pod is out of pending
@@ -567,12 +572,14 @@ func followInstallation(config *newcmd.AppConfig, pod *corev1.Pod, logsForObject
567572 opts := & kcmd.LogsOptions {
568573 Namespace : pod .Namespace ,
569574 ResourceArg : pod .Name ,
570- Options : & kapi .PodLogOptions {
575+ Options : & corev1 .PodLogOptions {
571576 Follow : true ,
572577 Container : pod .Spec .Containers [0 ].Name ,
573578 },
574- LogsForObject : logsForObjectFn ,
575- IOStreams : genericclioptions.IOStreams {Out : config .Out },
579+ RESTClientGetter : clientGetter ,
580+ ConsumeRequestFn : kcmd .DefaultConsumeRequestFn ,
581+ LogsForObject : logsForObjectFn ,
582+ IOStreams : genericclioptions.IOStreams {Out : config .Out },
576583 }
577584 logErr := opts .RunLogs ()
578585
0 commit comments