Merge pull request #92178 from zhouya0/remove_kubectl_run_replicas_flag

Remove kubectl run validate replicas logic
This commit is contained in:
Kubernetes Prow Robot 2020-06-22 15:01:54 -07:00 committed by GitHub
commit e24cbc9263
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 0 additions and 17 deletions

View File

@ -280,10 +280,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
if o.TTY && !o.Interactive {
return cmdutil.UsageErrorf(cmd, "-i/--stdin is required for containers with -t/--tty=true")
}
replicas := cmdutil.GetFlagInt(cmd, "replicas")
if o.Interactive && replicas != 1 {
return cmdutil.UsageErrorf(cmd, "-i/--stdin requires that replicas is 1, found %d", replicas)
}
if o.Expose && len(o.Port) == 0 {
return cmdutil.UsageErrorf(cmd, "--port must be set when exposing a service")
}
@ -296,9 +292,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
if err != nil {
return err
}
if restartPolicy != corev1.RestartPolicyAlways && replicas != 1 {
return cmdutil.UsageErrorf(cmd, "--restart=%s requires that --replicas=1, found %d", restartPolicy, replicas)
}
remove := cmdutil.GetFlagBool(cmd, "rm")
if !o.Attach && remove {

View File

@ -441,16 +441,6 @@ func TestRunValidations(t *testing.T) {
},
expectedErr: "Invalid image name",
},
{
name: "test stdin replicas value",
args: []string{"test"},
flags: map[string]string{
"image": "busybox",
"stdin": "true",
"replicas": "2",
},
expectedErr: "stdin requires that replicas is 1",
},
{
name: "test rm errors when used on non-attached containers",
args: []string{"test"},