Skip to content

Commit

Permalink
update log cmd to use corev1.PodLogOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
juanvallejo committed Aug 1, 2018
1 parent a1d13d0 commit 0d9e138
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions pkg/oc/cli/logs/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (

"github.com/spf13/cobra"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
kapi "k8s.io/kubernetes/pkg/apis/core"
kcmd "k8s.io/kubernetes/pkg/kubectl/cmd"
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
kcmdutil "k8s.io/kubernetes/pkg/kubectl/cmd/util"
Expand Down Expand Up @@ -84,6 +84,7 @@ func NewLogsOptions(streams genericclioptions.IOStreams) *LogsOptions {
return &LogsOptions{
KubeLogOptions: &kcmd.LogsOptions{
IOStreams: streams,
Tail: -1,
},
IOStreams: streams,
}
Expand All @@ -99,7 +100,7 @@ func NewCmdLogs(name, baseName string, f kcmdutil.Factory, streams genericcliopt
cmd.SuggestFor = []string{"builds", "deployments"}
cmd.Run = func(cmd *cobra.Command, args []string) {
kcmdutil.CheckErr(o.Complete(f, cmd, args))
kcmdutil.CheckErr(o.Validate())
kcmdutil.CheckErr(o.Validate(args))
kcmdutil.CheckErr(o.RunLog())
}

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

// Validate runs the upstream validation for the logs command and then it
// will validate any OpenShift-specific log options.
func (o *LogsOptions) Validate() error {
func (o *LogsOptions) Validate(args []string) error {
if err := o.KubeLogOptions.Validate(); err != nil {
return err
}
Expand All @@ -176,7 +177,7 @@ func (o *LogsOptions) Validate() error {
// RunLog will run the upstream logs command and may use an OpenShift
// logOptions object.
func (o *LogsOptions) RunLog() error {
podLogOptions := o.KubeLogOptions.Options.(*kapi.PodLogOptions)
podLogOptions := o.KubeLogOptions.Options.(*corev1.PodLogOptions)
infos, err := o.Builder().
WithScheme(scheme.Scheme, scheme.Scheme.PrioritizedVersionsAllGroups()...).
NamespaceParam(o.Namespace).DefaultNamespace().
Expand Down

0 comments on commit 0d9e138

Please sign in to comment.