Merge pull request #51077 from zjj2wry/log-selector
Automatic merge from submit-queue (batch tested with PRs 50257, 50247, 50665, 50554, 51077) fix issue(51027)kubect logs --selector ignoring --tail=-1 **What this PR does / why we need it**: closes issue #51027 **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note Fix kubect logs --selector ignoring --tail=-1 ```
This commit is contained in:
		@@ -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 {
 | 
						if limit := cmdutil.GetFlagInt64(cmd, "limit-bytes"); limit != 0 {
 | 
				
			||||||
		logOptions.LimitBytes = &limit
 | 
							logOptions.LimitBytes = &limit
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if tail := cmdutil.GetFlagInt64(cmd, "tail"); tail != -1 {
 | 
						tail := cmdutil.GetFlagInt64(cmd, "tail")
 | 
				
			||||||
 | 
						if tail != -1 {
 | 
				
			||||||
		logOptions.TailLines = &tail
 | 
							logOptions.TailLines = &tail
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if sinceSeconds := cmdutil.GetFlagDuration(cmd, "since"); sinceSeconds != 0 {
 | 
						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 {
 | 
							if logOptions.Follow {
 | 
				
			||||||
			return cmdutil.UsageErrorf(cmd, "only one of follow (-f) or selector (-l) is allowed")
 | 
								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
 | 
								logOptions.TailLines = &selectorTail
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user