mirror of https://github.com/k3s-io/k3s
fix kubectl issue(#52)kubectl run --expose continues after error (missing port)
parent
e6e963ea51
commit
c11a9fc95d
|
@ -176,6 +176,9 @@ func RunRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *c
|
||||||
if interactive && replicas != 1 {
|
if interactive && replicas != 1 {
|
||||||
return cmdutil.UsageErrorf(cmd, "-i/--stdin requires that replicas is 1, found %d", replicas)
|
return cmdutil.UsageErrorf(cmd, "-i/--stdin requires that replicas is 1, found %d", replicas)
|
||||||
}
|
}
|
||||||
|
if cmdutil.GetFlagBool(cmd, "expose") && len(cmdutil.GetFlagString(cmd, "port")) == 0 {
|
||||||
|
return cmdutil.UsageErrorf(cmd, "--port must be set when exposing a service")
|
||||||
|
}
|
||||||
|
|
||||||
namespace, _, err := f.DefaultNamespace()
|
namespace, _, err := f.DefaultNamespace()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -537,11 +540,6 @@ func generateService(f cmdutil.Factory, cmd *cobra.Command, args []string, servi
|
||||||
}
|
}
|
||||||
names := generator.ParamNames()
|
names := generator.ParamNames()
|
||||||
|
|
||||||
port := cmdutil.GetFlagString(cmd, "port")
|
|
||||||
if len(port) == 0 {
|
|
||||||
return nil, fmt.Errorf("--port must be set when exposing a service")
|
|
||||||
}
|
|
||||||
|
|
||||||
params := map[string]interface{}{}
|
params := map[string]interface{}{}
|
||||||
for key, value := range paramsIn {
|
for key, value := range paramsIn {
|
||||||
_, isString := value.(string)
|
_, isString := value.(string)
|
||||||
|
|
Loading…
Reference in New Issue