mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-24 12:15:52 +00:00
Remove kubectl run validate replicas logic
This commit is contained in:
parent
73fa63a86d
commit
4b82d5ae08
@ -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 {
|
||||
|
@ -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"},
|
||||
|
Loading…
Reference in New Issue
Block a user