LabSizeDefinition#

pydantic model controller.config.LabSizeDefinition#

Possible size of lab.

This will be used to set resource limits and requests in Kubernetes, meaning that setting a lower CPU request than a limit will result in throttling, and setting a lower memory request than a limit may result in the lab being killed with an out-of-memory error before it has reached its limit.

Parameters:

data (Any)

Show JSON schema
{
   "title": "LabSizeDefinition",
   "description": "Possible size of lab.\n\nThis will be used to set resource limits and requests in Kubernetes,\nmeaning that setting a lower CPU request than a limit will result in\nthrottling, and setting a lower memory request than a limit may result in\nthe lab being killed with an out-of-memory error before it has reached its\nlimit.",
   "type": "object",
   "properties": {
      "size": {
         "$ref": "#/$defs/LabSize",
         "description": "Human-readable name for this lab size",
         "examples": [
            "small",
            "huge"
         ],
         "title": "Lab size"
      },
      "resources": {
         "$ref": "#/$defs/LabResources",
         "description": "Kubernetes memory and CPU requests and limits",
         "title": "Kubernetes resources"
      }
   },
   "$defs": {
      "LabResources": {
         "description": "Resource requests and limits for a lab.",
         "properties": {
            "limits": {
               "$ref": "#/$defs/ResourceQuantity",
               "description": "If the user's pod exceeds this CPU limit, it will be throttled. If it exceeds this memory limit, it will usually be killed with an out-of-memory error.",
               "title": "Maximum allowed resources"
            },
            "requests": {
               "$ref": "#/$defs/ResourceQuantity",
               "description": "Guaranteed minimum resources available to the user's lab. If these resources are not available, the cluster will autoscale or the lab spawn will fail.",
               "title": "Minimum requested resources"
            }
         },
         "required": [
            "limits",
            "requests"
         ],
         "title": "LabResources",
         "type": "object"
      },
      "LabSize": {
         "description": "Allowable names for pod sizes.\n\nTaken from `d20 creature sizes`_.",
         "enum": [
            "fine",
            "diminutive",
            "tiny",
            "small",
            "medium",
            "large",
            "huge",
            "gargantuan",
            "colossal",
            "custom"
         ],
         "title": "LabSize",
         "type": "string"
      },
      "ResourceQuantity": {
         "description": "A Kubernetes resource request or limit.",
         "properties": {
            "cpu": {
               "description": "Number of CPU cores. Accepts any valid Kubernetes CPU resource specification, which is either a whole number of millicores suffixed with m, like 500m, or a decimal number representing whole cores, with up to 3 decimal places, like 1.234",
               "examples": [
                  1.5,
                  "500m",
                  "1.5"
               ],
               "title": "CPU",
               "type": "number"
            },
            "memory": {
               "description": "Amount of memory in bytes. Also accepts strings with SI suffixes, which will be converted to bytes. Be sure to use the suffix with ``i`` to indicate powers of two (1024 rather than 1000) if that is desired.",
               "examples": [
                  1073741824,
                  "1Gi",
                  "1073741824"
               ],
               "title": "Memory",
               "type": "integer"
            }
         },
         "required": [
            "cpu",
            "memory"
         ],
         "title": "ResourceQuantity",
         "type": "object"
      }
   },
   "additionalProperties": false,
   "required": [
      "size",
      "resources"
   ]
}

Fields:
field resources: Annotated[LabResources, Field(title='Kubernetes resources', description='Kubernetes memory and CPU requests and limits')] [Required]#

Kubernetes memory and CPU requests and limits

field size: Annotated[LabSize, Field(title='Lab size', description='Human-readable name for this lab size', examples=[LabSize.SMALL, LabSize.HUGE])] [Required]#

Human-readable name for this lab size