Skip to content
Proud to collaborate with Microsoft for Startups

kubernetes.limitrange.ensure ​

Create or replace a namespaced Kubernetes LimitRange

Creates a LimitRange in the given namespace; replaces it in full if it already exists. Accepts a pre-built limitrange_spec dict matching the Kubernetes V1LimitRangeSpec schema.

A LimitRange is the companion to a ResourceQuota, and a namespace usually needs both. A ResourceQuota caps the namespace in aggregate, but it only counts containers that declare requests and limits — so once a quota on requests.cpu exists, Kubernetes rejects any container that declares none. A LimitRange with default and defaultRequest supplies those values automatically, which is what stops a quota from breaking every workload that did not spell out its resources.

max / min additionally bound what a single container may ask for, so one oversized pod cannot consume a tenant's whole quota by itself.

Why replace and not patch ​

spec.limits is a list of typed entries, and merge semantics on it are not what a caller declaring a full policy expects: an entry dropped from the declared spec could survive on the cluster. Replacement makes the live object match limitrange_spec exactly.

Changing a LimitRange does not retroactively alter running pods — the defaults are applied at admission. Existing workloads keep the values they were admitted with until they are recreated.

Inputs:

  • connection_uuid: Cloud connection UUID (required)
  • namespace: Target namespace (required)
  • name: LimitRange name (required)
  • limitrange_spec: Full V1LimitRangeSpec dict (required), i.e.
  • labels: Optional dict of metadata labels set on the object.

Outputs:

  • existed: True if an existing LimitRange was replaced, False if created.

Plugin required: context.get_plugin("connection").kubernetes_runner_clients(connection_uuid, organization_uuid) must expose core_v1 with read_namespaced_limit_range, replace_namespaced_limit_range, create_namespaced_limit_range.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-kubernetes
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes——
namespacestringYes——
namestringYes——
limitrange_specjsonYes——
labelsjsonNo——
organization_uuiduuidNo——

Output Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo——
organization_uuiduuidNo——
namespacestringNo——
namestringNo——
limitrange_specjsonNo——
labelsjsonNo——
existedbooleanNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerstringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

API Usage ​

bash
POST /api/workflows/start
Content-Type: application/json

{
  "workflow_type": "kubernetes.limitrange.ensure",
  "initial_data": {
    "connection_uuid": "value",
    "namespace": "value",
    "name": "value",
    "limitrange_spec": "value"
  }
}