From 28746831e12e0ed0ccfa72d81a59a10f01b7552f Mon Sep 17 00:00:00 2001 From: zhengjiajin Date: Tue, 22 Aug 2017 12:26:38 +0800 Subject: [PATCH] fix issue(51027)kubect logs --selector ignoring --tail=-1 --- pkg/kubectl/cmd/logs.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/kubectl/cmd/logs.go b/pkg/kubectl/cmd/logs.go index 8c1ee97750..6881f1e65e 100644 --- a/pkg/kubectl/cmd/logs.go +++ b/pkg/kubectl/cmd/logs.go @@ -165,7 +165,8 @@ func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Comm if limit := cmdutil.GetFlagInt64(cmd, "limit-bytes"); limit != 0 { logOptions.LimitBytes = &limit } - if tail := cmdutil.GetFlagInt64(cmd, "tail"); tail != -1 { + tail := cmdutil.GetFlagInt64(cmd, "tail") + if tail != -1 { logOptions.TailLines = &tail } if sinceSeconds := cmdutil.GetFlagDuration(cmd, "since"); sinceSeconds != 0 { @@ -185,7 +186,7 @@ func (o *LogsOptions) Complete(f cmdutil.Factory, out io.Writer, cmd *cobra.Comm if logOptions.Follow { return cmdutil.UsageErrorf(cmd, "only one of follow (-f) or selector (-l) is allowed") } - if logOptions.TailLines == nil { + if logOptions.TailLines == nil && tail != -1 { logOptions.TailLines = &selectorTail } }