kubernetes.poddisruptionbudget.ensure ​
Create or replace a namespaced Kubernetes PodDisruptionBudget (policy/v1)
Creates a PodDisruptionBudget in the given namespace; replaces it in full if it already exists. Accepts a pre-built pdb_spec dict matching the Kubernetes V1PodDisruptionBudgetSpec schema.
A PDB bounds voluntary disruption: node drains, cluster autoscaler scale-down, and managed node-image upgrades. It does not protect against a node failing, a pod being OOM-killed, or a rollout — those are involuntary or controller-driven and ignore the budget entirely. Treating a PDB as general availability insurance is the usual misreading.
Two traps worth knowing before setting one:
minAvailable: 1 on a single-replica workload blocks drains outright. There is no way to evict the only pod while still keeping one available, so the node never finishes draining and a cluster upgrade stalls. Single-replica stateful workloads want either no PDB or maxUnavailable: 1.
spec.selector is immutable on some Kubernetes versions. Where it is, a replace that changes the selector is rejected and the caller has to delete and recreate. The failure surfaces as a 422 from the API server, which this workflow propagates rather than papering over.
Inputs:
- connection_uuid: Cloud connection UUID (required)
- namespace: Target namespace (required)
- name: PodDisruptionBudget name (required)
- pdb_spec: Full V1PodDisruptionBudgetSpec dict (required). Supports
minAvailable,maxUnavailable,selector, andunhealthyPodEvictionPolicy. - labels: Optional dict of metadata labels set on the object.
Outputs:
- existed: True if an existing PDB was replaced, False if created.
Plugin required: context.get_plugin("connection").kubernetes_runner_clients(connection_uuid, organization_uuid) must expose policy_v1 — available from ltinteg-cloud-connections with the storage/policy/autoscaling clients.
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 | — | — |
pdb_spec | json | Yes | — | — |
labels | json | No | — | — |
workflow_run_id | string | No | — | Engine workflow run id for DAG step execution |
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 | — | — |
pdb_spec | json | No | — | — |
labels | json | No | — | — |
existed | boolean | No | — | — |
workflow_run_id | string | No | — | Engine workflow run id for DAG step execution |
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.poddisruptionbudget.ensure",
"initial_data": {
"connection_uuid": "value",
"namespace": "value",
"name": "value",
"pdb_spec": "value"
}
}