cloudfoundry / cli

The official command line client for Cloud Foundry
https://docs.cloudfoundry.org/cf-cli
Apache License 2.0
1.75k stars 926 forks source link

Can't create quota plan with 0 memory. #2044

Open stephanme opened 4 years ago

stephanme commented 4 years ago

Please fill out the issue checklist below and provide ALL the requested information.

Describe the bug and the command you saw an issue with

Can't create quota plan with 0 memory.

What happened

cf cli (7.0.2 and also 6.52.0) complains about incorrect usage. Looks like the parameter validation of cf cli doesn't allow 0 memory and 0 instance memory. There is no interaction with CF API at all.

Expected behavior

Quota plan with 0 memory and 0 instance memory is created. This was possible with cf cli 6.49.0.

Exact Steps To Reproduce

Logged in with admin rights:

[root@iacbox-v380]:/users/d047883/landscape-aws-staging$ cf7 version
cf7 version 7.0.2+17b4eeafd.2020-07-24

[root@iacbox-v380]:/users/d047883/landscape-aws-staging$ cf7 create-quota zero-mem-quota -m 0GB -r 0 -s 10 -i 0GB --allow-paid-service-plans -v
Incorrect Usage: Byte quantity must be an integer with a unit of measurement like M, MB, G, or GB

NAME:
   create-org-quota - Define a new quota for an organization

USAGE:
   cf7 create-org-quota ORG_QUOTA [-m TOTAL_MEMORY] [-i INSTANCE_MEMORY] [-r ROUTES] [-s SERVICE_INSTANCES] [-a APP_INSTANCES] [--allow-paid-service-plans] [--reserved-route-ports RESERVED_ROUTE_PORTS]

ALIAS:
   create-quota

OPTIONS:
   -a                              Total number of application instances. (Default: unlimited).
   --allow-paid-service-plans      Allow provisioning instances of paid service plans. (Default: disallowed).
   -i                              Maximum amount of memory a process can have (e.g. 1024M, 1G, 10G). (Default: unlimited).
   -m                              Total amount of memory all processes can have (e.g. 1024M, 1G, 10G).  -1 represents an unlimited amount. (Default: 0).
   -r                              Total number of routes. -1 represents an unlimited amount. (Default: 0).
   --reserved-route-ports          Maximum number of routes that may be created with ports. -1 represents an unlimited amount. (Default: 0).
   -s                              Total number of service instances. -1 represents an unlimited amount. (Default: 0).

SEE ALSO:
   create-org, org-quotas, set-org-quota

Provide more context

[root@iacbox-v380]:/users/d047883/landscape-aws-staging$ cf version
cf version 6.52.0+b086fe522.2020-08-26
[root@iacbox-v380]:/users/d047883/landscape-aws-staging$ cf7 version
cf7 version 7.0.2+17b4eeafd.2020-07-24

(running on Ubuntu)

CF 13.14.0 CF API v2.151.0, v3.86.0 (capi-release patched down to 1.96.0 because of the Azure problem in 1.97.0)

cf-gitbot commented 4 years ago

We have created an issue in Pivotal Tracker to manage this:

https://www.pivotaltracker.com/story/show/174689337

The labels on this github issue will be updated when the story is started.

heyjcollins commented 3 years ago

Thanks for pointing out this reproducible issue @stephanme. Before we take action I'd like a little more information. Can you describe the use case that requires creating a quota plan with 0 mem and 0 instance mem?

Also - I'm not sure if this is helpful or not, but it is possible to create a quota plan with 0 mem in the current v7 CLI by not passing the -m flag/value in the create-*-quota command

stephanme commented 3 years ago

One of our use case is an org that just exists for owning a private domain. The private domain is then shared into other orgs where applications are deployed (and which have a real memory quota of course). There may be more use cases I need to check with colleagues who opened internal tickets.

Creating a quota without -m flag works. But if I skip the -i flag this quota plan gets unlimited instance memory. This is something we want to avoid (have seen issues with very large app instances) and we run reports about org quotas from time to time. Also, this doesn't work for cf7 update-quota.

We found two possible workarounds:

Not nice either I would say.

bengerman13 commented 2 years ago

We're also running into this. issue using 7.4.0. Our use case is spaces dedicated to brokered service instances that don't have direct relationships to any one application instance.