Skip to content

Commit edab9c9

Browse files
authored
Merge pull request kubernetes#87152 from soltysh/embed_logs
Allow embedding logs command
2 parents 821d0e8 + 925be29 commit edab9c9

File tree

1 file changed

+5
-1
lines changed
  • staging/src/k8s.io/kubectl/pkg/cmd/logs

1 file changed

+5
-1
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/logs/logs.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,11 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
153153
cmdutil.CheckErr(o.RunLogs())
154154
},
155155
}
156+
o.AddFlags(cmd)
157+
return cmd
158+
}
159+
160+
func (o *LogsOptions) AddFlags(cmd *cobra.Command) {
156161
cmd.Flags().BoolVar(&o.AllContainers, "all-containers", o.AllContainers, "Get all containers' logs in the pod(s).")
157162
cmd.Flags().BoolVarP(&o.Follow, "follow", "f", o.Follow, "Specify if the logs should be streamed.")
158163
cmd.Flags().BoolVar(&o.Timestamps, "timestamps", o.Timestamps, "Include timestamps on each line in the log output")
@@ -169,7 +174,6 @@ func NewCmdLogs(f cmdutil.Factory, streams genericclioptions.IOStreams) *cobra.C
169174
cmd.Flags().StringVarP(&o.Selector, "selector", "l", o.Selector, "Selector (label query) to filter on.")
170175
cmd.Flags().IntVar(&o.MaxFollowConcurrency, "max-log-requests", o.MaxFollowConcurrency, "Specify maximum number of concurrent logs to follow when using by a selector. Defaults to 5.")
171176
cmd.Flags().BoolVar(&o.Prefix, "prefix", o.Prefix, "Prefix each log line with the log source (pod name and container name)")
172-
return cmd
173177
}
174178

175179
func (o *LogsOptions) ToLogOptions() (*corev1.PodLogOptions, error) {

0 commit comments

Comments
 (0)