Skip to content

Commit 8ca712f

Browse files
committed
update log cmd to use corev1.PodLogOptions
1 parent 7a6e587 commit 8ca712f

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

pkg/oc/cli/logs/logs.go

Lines changed: 5 additions & 4 deletions
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"
@@ -84,6 +84,7 @@ func NewLogsOptions(streams genericclioptions.IOStreams) *LogsOptions {
8484
return &LogsOptions{
8585
KubeLogOptions: &kcmd.LogsOptions{
8686
IOStreams: streams,
87+
Tail: -1,
8788
},
8889
IOStreams: streams,
8990
}
@@ -99,7 +100,7 @@ func NewCmdLogs(name, baseName string, f kcmdutil.Factory, streams genericcliopt
99100
cmd.SuggestFor = []string{"builds", "deployments"}
100101
cmd.Run = func(cmd *cobra.Command, args []string) {
101102
kcmdutil.CheckErr(o.Complete(f, cmd, args))
102-
kcmdutil.CheckErr(o.Validate())
103+
kcmdutil.CheckErr(o.Validate(args))
103104
kcmdutil.CheckErr(o.RunLog())
104105
}
105106

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

152153
// Validate runs the upstream validation for the logs command and then it
153154
// will validate any OpenShift-specific log options.
154-
func (o *LogsOptions) Validate() error {
155+
func (o *LogsOptions) Validate(args []string) error {
155156
if err := o.KubeLogOptions.Validate(); err != nil {
156157
return err
157158
}
@@ -176,7 +177,7 @@ func (o *LogsOptions) Validate() error {
176177
// RunLog will run the upstream logs command and may use an OpenShift
177178
// logOptions object.
178179
func (o *LogsOptions) RunLog() error {
179-
podLogOptions := o.KubeLogOptions.Options.(*kapi.PodLogOptions)
180+
podLogOptions := o.KubeLogOptions.Options.(*corev1.PodLogOptions)
180181
infos, err := o.Builder().
181182
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
182183
NamespaceParam(o.Namespace).DefaultNamespace().

0 commit comments

Comments
 (0)