mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-31 23:37:01 +00:00
Merge pull request #50834 from zjj2wry/fix_validation_expose_port
Automatic merge from submit-queue (batch tested with PRs 50281, 50747, 50347, 50834, 50852) fix kubectl issue(#52)kubectl run --expose continues after error (mis… …sing port) **What this PR does / why we need it**: https://github.com/kubernetes/kubectl/issues/52 **Which issue this PR fixes** *(optional, in `fixes #<issue number>(, fixes #<issue_number>, ...)` format, will close that issue when PR gets merged)*: fixes # **Special notes for your reviewer**: **Release note**: ```release-note NONE ```
This commit is contained in:
commit
d958a35ab9
@ -176,6 +176,9 @@ func RunRun(f cmdutil.Factory, cmdIn io.Reader, cmdOut, cmdErr io.Writer, cmd *c
|
||||
if interactive && replicas != 1 {
|
||||
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()
|
||||
if err != nil {
|
||||
@ -537,11 +540,6 @@ func generateService(f cmdutil.Factory, cmd *cobra.Command, args []string, servi
|
||||
}
|
||||
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{}{}
|
||||
for key, value := range paramsIn {
|
||||
_, isString := value.(string)
|
||||
|
Loading…
Reference in New Issue
Block a user