Constraints on size

What are size constraints?

When a member of your team creates, resizes, or edits a machine you can set minimum and maximum limits on cpu, ram, primary disk, and swap disk sizes, or completely hide some of these fields.
Some clouds allow you to completely customize the ram, cpu, and disk sizes (within a range), while others offer a predetermined list of sizes to choose from.

How can I add size constraints?

From the Teams section:

  1. Make sure you belong to the Owners team.
  2. Open the teams page and click on the team you want to set size constraints on.
  3. Click the gear icon next to an RBAC policy that applies to machines.
  4. Input a JSON with the relevant quota parameters.
  5. Click Save
  6. Click "Save policy" for the changes to take effect

Allowed parameters

{
  "size": {
    // Enter names, ids or external ids of the sizes you want to include
    "allowed": [ 
      "Standard_F1" 
    ],
    // Enter names, ids or external ids of the sizes you want to hide
    "not_allowed": [
      "f1-micro",
      "g1-small"
    ],
    // Primary disk
    "disk": {
      "show": true, // Show/Hide field
      "min": 1 // Size in GB
    },
    // Swap disk
    "swap": {
      "show": true, // Show/Hide field
      "max": 2 // Size in GB
    },
    "ram": {
      "show": true, // Show/Hide field
      "min": 100, // Size in MB
      "max": 512 // Size in MB
    },
    "cpu": {
      "show": true, // Show/Hide field.
      "min": 1 // Number of cores
    }
  }
}

Examples

Example 1: A cloud that supports custom sizes

This is the default view when creating an LXD machine:

We want to set the following constraints for team members:

  • The minimum allowed ram size should be 512MB and the maximum allowed ram size should be 2048MB
  • The maximum disk size should be 100GB
  • We want to allow only 1 CPU core always, so we want to hide the CPU field from our team completely
The size constraints should be formatted like this:
{
  "size":{
    "disk":{
      "max":100
    },
    "ram":{
      "min":512,
      "max":2048
    },
    "cpu":{
      "show":false
    }
  }
}

This is how the team member will see the machine creation form:

Example 2: A cloud with predetermined sizes

This is the default view when creating a GCE machine:

We want to allow team members to only create the two smallest machines. 

The size constraints should be formatted like this:

{
  "size":{
    "allowed":[
      "f1-micro",
      "g1-small"
    ]
  }
}

This is how the team member will see the machine creation form:

Please keep in mind that constraints are supported in Mist v4.2 and later. Also, they are available only in Mist Hosted Service (HS) and Mist Enterprise Edition (EE).

Still need help? Contact Us Contact Us