kubernetes.clusterrole.ensure ​
Create or replace a ClusterRole (cluster-scoped, rbac.authorization.k8s.io/v1)
Creates a ClusterRole (rbac.authorization.k8s.io/v1); replaces it via patch if it already exists. ClusterRoles are cluster-scoped — no namespace input.
Inputs:
- connection_uuid: Cloud connection UUID (required)
- name: ClusterRole name (required)
- rules: List of PolicyRule dicts, each with
apiGroups,resources,verbsand optionalresourceNames(required; pass[]when using aggregation_rule). - aggregation_rule: Optional dict {clusterRoleSelectors: [...]}. When set, the control plane computes
rulesfrom the matched ClusterRoles and any supplied rules are overwritten.
Outputs:
- existed: True if the ClusterRole was patched, False if it was created.
Plugin required: context.get_plugin("connection").kubernetes_runner_clients(connection_uuid, organization_uuid) must expose rbac_authorization_v1 (a RbacAuthorizationV1Api instance) with read_cluster_role, patch_cluster_role, create_cluster_role.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-kubernetes |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | Yes | — | — |
name | string | Yes | — | — |
rules | json | Yes | — | — |
aggregation_rule | json | No | — | — |
organization_uuid | uuid | No | — | — |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
connection_uuid | uuid | No | — | — |
organization_uuid | uuid | No | — | — |
name | string | No | — | — |
rules | json | No | — | — |
aggregation_rule | 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 ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "kubernetes.clusterrole.ensure",
"initial_data": {
"connection_uuid": "value",
"name": "value",
"rules": "value"
}
}