kubernetes.service.ensure ​
Create or replace a namespaced Kubernetes Service
Creates a Service in the given namespace; replaces it if it already exists. Accepts a pre-built service_spec dict matching the Kubernetes V1Service schema so callers build the spec however they want (ClusterIP, NodePort, LoadBalancer, headless, etc.).
When replacing, spec.cluster_ip is preserved from the existing object — Kubernetes rejects spec updates that try to change a previously-assigned cluster IP.
Inputs:
- connection_uuid: Cloud connection UUID (required)
- namespace: Target namespace (required)
- name: Service name (required)
- service_spec: Full V1Service dict (required).
Outputs:
- namespace, name, existed: bool
Plugin required: context.get_plugin("connection").kubernetes_runner_clients(connection_uuid, organization_uuid) must expose core_v1 with read_namespaced_service, create_namespaced_service, replace_namespaced_service.
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 | — | — |
service_spec | json | Yes | — | — |
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 | — | — |
service_spec | 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 ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "kubernetes.service.ensure",
"initial_data": {
"connection_uuid": "value",
"namespace": "value",
"name": "value",
"service_spec": "value"
}
}