Skip to content

Commit 4b82d5a

Browse files
committed
Remove kubectl run validate replicas logic
1 parent 73fa63a commit 4b82d5a

File tree

2 files changed

+0
-17
lines changed

2 files changed

+0
-17
lines changed

staging/src/k8s.io/kubectl/pkg/cmd/run/run.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
280280
if o.TTY && !o.Interactive {
281281
return cmdutil.UsageErrorf(cmd, "-i/--stdin is required for containers with -t/--tty=true")
282282
}
283-
replicas := cmdutil.GetFlagInt(cmd, "replicas")
284-
if o.Interactive && replicas != 1 {
285-
return cmdutil.UsageErrorf(cmd, "-i/--stdin requires that replicas is 1, found %d", replicas)
286-
}
287283
if o.Expose && len(o.Port) == 0 {
288284
return cmdutil.UsageErrorf(cmd, "--port must be set when exposing a service")
289285
}
@@ -296,9 +292,6 @@ func (o *RunOptions) Run(f cmdutil.Factory, cmd *cobra.Command, args []string) e
296292
if err != nil {
297293
return err
298294
}
299-
if restartPolicy != corev1.RestartPolicyAlways && replicas != 1 {
300-
return cmdutil.UsageErrorf(cmd, "--restart=%s requires that --replicas=1, found %d", restartPolicy, replicas)
301-
}
302295

303296
remove := cmdutil.GetFlagBool(cmd, "rm")
304297
if !o.Attach && remove {

staging/src/k8s.io/kubectl/pkg/cmd/run/run_test.go

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -441,16 +441,6 @@ func TestRunValidations(t *testing.T) {
441441
},
442442
expectedErr: "Invalid image name",
443443
},
444-
{
445-
name: "test stdin replicas value",
446-
args: []string{"test"},
447-
flags: map[string]string{
448-
"image": "busybox",
449-
"stdin": "true",
450-
"replicas": "2",
451-
},
452-
expectedErr: "stdin requires that replicas is 1",
453-
},
454444
{
455445
name: "test rm errors when used on non-attached containers",
456446
args: []string{"test"},

0 commit comments

Comments
 (0)