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 ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-kubernetes |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | Yes | — | — |
namespace | string | Yes | — | — |
name | string | Yes | — | — |
limitrange_spec | json | Yes | — | — |
labels | json | No | — | — |
organization_uuid | uuid | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | — |
organization_uuid | uuid | No | — | — |
namespace | string | No | — | — |
name | string | No | — | — |
limitrange_spec | json | No | — | — |
labels | json | No | — | — |
existed | boolean | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage ​
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"
}
}