Skip to content
Proud to collaborate with Microsoft for Startups

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, and unhealthyPodEvictionPolicy.
  • 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 ​

PropertyValue
Workflow typeAtomic
LibraryApp-kubernetes
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes——
namespacestringYes——
namestringYes——
pdb_specjsonYes——
labelsjsonNo——
workflow_run_idstringNo—Engine workflow run id for DAG step execution
organization_uuiduuidNo——

Output Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo——
organization_uuiduuidNo——
namespacestringNo——
namestringNo——
pdb_specjsonNo——
labelsjsonNo——
existedbooleanNo——
workflow_run_idstringNo—Engine workflow run id for DAG step execution
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.poddisruptionbudget.ensure",
  "initial_data": {
    "connection_uuid": "value",
    "namespace": "value",
    "name": "value",
    "pdb_spec": "value"
  }
}