Container constraints (limits) now supported


#1

Using Juju to deploy a Kubernetes charm, you can now specify resource limits for memory and cpu. The cpu units are milli cpu. The standard Juju constraint syntax is used.

Note: right now, the constraint values are mapped to resource limits. There’s no support for resource requests. This conforms to the behaviour of LXD constraints.

Example

juju deploy mariadb-k8s --constraints "mem=4G cpu-power=500"


Juju Show #39 - Beedy show and tell and news!
#2

In the linked text, it seems that if you wanted to specify “milli” you would pass a little “m”. So 1 would imply 1 CPU, while 1m would be 1/1000 of a CPU. With the intent that the granularity that you can supply is 1/1000. Do you translate 500 to 500m internally? Or do you just pass the value that the user supplies directly to K8s?


#3

The cpu value specified via the --constraints arg is an int, and the implicit unit is “milli CPUs”.
K8s requires a value plus unit, so 500 is translated to “500m” to pass to Kubernetes.