Skip to content
Proud to collaborate with Microsoft for Startups

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, verbs and optional resourceNames (required; pass [] when using aggregation_rule).
  • aggregation_rule: Optional dict {clusterRoleSelectors: [...]}. When set, the control plane computes rules from 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 ​

PropertyValue
Workflow typeAtomic
LibraryApp-kubernetes
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidYes——
namestringYes——
rulesjsonYes——
aggregation_rulejsonNo——
organization_uuiduuidNo——

Output Schema ​

FieldTypeRequiredDefaultDescription
connection_uuiduuidNo——
organization_uuiduuidNo——
namestringNo——
rulesjsonNo——
aggregation_rulejsonNo——
existedbooleanNo——
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.clusterrole.ensure",
  "initial_data": {
    "connection_uuid": "value",
    "name": "value",
    "rules": "value"
  }
}