fix kubectl run --generator=xxx bug

Kubernetes-commit: 860845b58216fa7fa058bacd06b4be5caefa6251
This commit is contained in:
ZP-AlwaysWin 2019-09-15 14:27:33 +08:00 committed by Kubernetes Publisher
parent ff65a06824
commit b3895b0e0e
1 changed files with 6 additions and 5 deletions

View File

@ -339,6 +339,12 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
}
}
generators := generateversioned.GeneratorFn("run")
generator, found := generators[generatorName]
if !found {
return cmdutil.UsageErrorf(cmd, "generator %q not found", generatorName)
}
// start deprecating all generators except for 'run-pod/v1' which will be
// the only supported on a route to simple kubectl run which should mimic
// docker run
@ -346,11 +352,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
fmt.Fprintf(o.ErrOut, "kubectl run --generator=%s is DEPRECATED and will be removed in a future version. Use kubectl run --generator=%s or kubectl create instead.\n", generatorName, generateversioned.RunPodV1GeneratorName)
}
generators := generateversioned.GeneratorFn("run")
generator, found := generators[generatorName]
if !found {
return cmdutil.UsageErrorf(cmd, "generator %q not found", generatorName)
}
names := generator.ParamNames()
params := generate.MakeParams(cmd, names)
params["name"] = args[0]