mirror of
https://github.com/optim-enterprises-bv/kubernetes.git
synced 2025-11-01 02:38:12 +00:00
allow kubectl cmd to process dirs recursively
reqs:
- the kubectl cmd must support the -f | --filename flag
- the kubectl cmd must support visiting a dir one level deep,
or using more than one resource
This commit is contained in:
@@ -35,6 +35,7 @@ import (
|
||||
// referencing the cmd.Flags()
|
||||
type CreateOptions struct {
|
||||
Filenames []string
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -71,6 +72,7 @@ func NewCmdCreate(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
|
||||
cmd.MarkFlagRequired("filename")
|
||||
cmdutil.AddValidateFlags(cmd)
|
||||
cmdutil.AddRecursiveFlag(cmd, &options.Recursive)
|
||||
cmdutil.AddOutputFlagsForMutation(cmd)
|
||||
cmdutil.AddApplyAnnotationFlags(cmd)
|
||||
cmdutil.AddRecordFlag(cmd)
|
||||
@@ -106,7 +108,7 @@ func RunCreate(f *cmdutil.Factory, cmd *cobra.Command, out io.Writer, options *C
|
||||
Schema(schema).
|
||||
ContinueOnError().
|
||||
NamespaceParam(cmdNamespace).DefaultNamespace().
|
||||
FilenameParam(enforceNamespace, options.Filenames...).
|
||||
FilenameParam(enforceNamespace, options.Recursive, options.Filenames...).
|
||||
Flatten().
|
||||
Do()
|
||||
err = r.Err()
|
||||
|
||||
Reference in New Issue
Block a user