Skip to content

Commit b4bd6a8

Browse files
juanvallejosoltysh
authored andcommitted
update log cmd to use corev1.PodLogOptions
1 parent 63af4c7 commit b4bd6a8

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

pkg/oc/cli/logs/logs.go

+6-8
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import (
66

77
"github.com/spf13/cobra"
88

9+
corev1 "k8s.io/api/core/v1"
910
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1011
"k8s.io/apimachinery/pkg/runtime"
11-
kapi "k8s.io/kubernetes/pkg/apis/core"
1212
kcmd "k8s.io/kubernetes/pkg/kubectl/cmd"
1313
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
1414
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
@@ -82,10 +82,8 @@ type LogsOptions struct {
8282

8383
func NewLogsOptions(streams genericclioptions.IOStreams) *LogsOptions {
8484
return &LogsOptions{
85-
KubeLogOptions: &kcmd.LogsOptions{
86-
IOStreams: streams,
87-
},
88-
IOStreams: streams,
85+
KubeLogOptions: kcmd.NewLogsOptions(streams, false),
86+
IOStreams: streams,
8987
}
9088
}
9189

@@ -99,7 +97,7 @@ func NewCmdLogs(name, baseName string, f kcmdutil.Factory, streams genericcliopt
9997
cmd.SuggestFor = []string{"builds", "deployments"}
10098
cmd.Run = func(cmd *cobra.Command, args []string) {
10199
kcmdutil.CheckErr(o.Complete(f, cmd, args))
102-
kcmdutil.CheckErr(o.Validate())
100+
kcmdutil.CheckErr(o.Validate(args))
103101
kcmdutil.CheckErr(o.RunLog())
104102
}
105103

@@ -151,7 +149,7 @@ func (o *LogsOptions) Complete(f kcmdutil.Factory, cmd *cobra.Command, args []st
151149

152150
// Validate runs the upstream validation for the logs command and then it
153151
// will validate any OpenShift-specific log options.
154-
func (o *LogsOptions) Validate() error {
152+
func (o *LogsOptions) Validate(args []string) error {
155153
if err := o.KubeLogOptions.Validate(); err != nil {
156154
return err
157155
}
@@ -176,7 +174,7 @@ func (o *LogsOptions) Validate() error {
176174
// RunLog will run the upstream logs command and may use an OpenShift
177175
// logOptions object.
178176
func (o *LogsOptions) RunLog() error {
179-
podLogOptions := o.KubeLogOptions.Options.(*kapi.PodLogOptions)
177+
podLogOptions := o.KubeLogOptions.Options.(*corev1.PodLogOptions)
180178
infos, err := o.Builder().
181179
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
182180
NamespaceParam(o.Namespace).DefaultNamespace().

0 commit comments

Comments
 (0)