Skip to content
Proud to collaborate with Microsoft for Startups

kubernetes.job.ensure ​

Create a Kubernetes Job; pass replace=true to delete+recreate if it already exists (Jobs are immutable)

Creates a Job in the given namespace. If a Job with the same name already exists and replace is false (the default) the workflow fails with a clear error — Jobs are immutable once submitted. If replace is true the existing Job is deleted (background propagation) before the new one is created.

Inputs:

  • connection_uuid: Cloud connection UUID (required)
  • namespace: Target namespace (required)
  • name: Job name (required)
  • job_spec: V1JobSpec dict (required). Minimum shape: {template: {spec: {containers: [...], restartPolicy: "OnFailure"}}}
  • replace: Delete + recreate if the Job already exists (optional, default false)

Outputs:

  • existed: bool — true when a Job with this name already existed
  • uid: string — UID assigned by Kubernetes to the newly-created Job

Plugin required: context.get_plugin("connection").kubernetes_runner_clients(connection_uuid, organization_uuid) must expose batch_v1 with read_namespaced_job, delete_namespaced_job, and create_namespaced_job.

Overview ​

PropertyValue
Workflow typeAtomic
LibraryApp-kubernetes
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes——
namespacestringYes——
namestringYes——
job_specjsonYes——
replacebooleanNo——
organization_uuiduuidNo——

Output Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo——
organization_uuiduuidNo——
namespacestringNo——
namestringNo——
job_specjsonNo——
replacebooleanNo——
existedbooleanNo——
uidstringNo——
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.job.ensure",
  "initial_data": {
    "connection_uuid": "value",
    "namespace": "value",
    "name": "value",
    "job_spec": "value"
  }
}