mirror of
https://github.com/k3s-io/kubernetes.git
synced 2026-01-04 15:05:20 +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:
@@ -37,8 +37,10 @@ type UndoOptions struct {
|
||||
Typer runtime.ObjectTyper
|
||||
Info *resource.Info
|
||||
ToRevision int64
|
||||
Out io.Writer
|
||||
Filenames []string
|
||||
|
||||
Out io.Writer
|
||||
Filenames []string
|
||||
Recursive bool
|
||||
}
|
||||
|
||||
const (
|
||||
@@ -67,6 +69,7 @@ func NewCmdRolloutUndo(f *cmdutil.Factory, out io.Writer) *cobra.Command {
|
||||
cmd.Flags().Int64("to-revision", 0, "The revision to rollback to. Default to 0 (last revision).")
|
||||
usage := "Filename, directory, or URL to a file identifying the resource to get from a server."
|
||||
kubectl.AddJsonFilenameFlag(cmd, &options.Filenames, usage)
|
||||
cmdutil.AddRecursiveFlag(cmd, &options.Recursive)
|
||||
return cmd
|
||||
}
|
||||
|
||||
@@ -86,7 +89,7 @@ func (o *UndoOptions) CompleteUndo(f *cmdutil.Factory, cmd *cobra.Command, out i
|
||||
|
||||
infos, err := resource.NewBuilder(o.Mapper, o.Typer, resource.ClientMapperFunc(f.ClientForMapping), f.Decoder(true)).
|
||||
NamespaceParam(cmdNamespace).DefaultNamespace().
|
||||
FilenameParam(enforceNamespace, o.Filenames...).
|
||||
FilenameParam(enforceNamespace, o.Recursive, o.Filenames...).
|
||||
ResourceTypeOrNameArgs(true, args...).
|
||||
Latest().
|
||||
Flatten().
|
||||
|
||||
Reference in New Issue
Block a user