任务调度实例版授权

更新时间:
复制为 MD 格式

本文提供了使用任务调度实例版进行任务调度时的权限配置指南,涵盖任务调度权限和云监控只读策略两大方面,确保系统的安全性和功能的完整性。

重要

如果您使用的是子账号,需同时配置任务调度权限和云监控只读权限。

任务调度权限

权限说明

以下接口仅支持授权到账号级别,无法支持按实例权限筛选展示,所有账号必须要授权该权限。

Action

权限说明

是否为只读类型

ListClusters

查看集群列表

ListClusterVersions

查看引擎版本列表

分为5个类型:查询、创建、更新、删除、运维操作。以下接口支持到实例级别,支持Action级别RAM权限。

类型

Action

权限说明

是否为只读

查询

ListAppNames

查询AppName列表

ListApps

查询应用列表

ListCalendar

查询日历列表

ListCalendarNames

查询自定义日历名字列表

ListExecutors

查询执行器列表

ListJobs

查询任务列表

ListJobExecutions

查询任务执行列表

ListScheduleTimes

查询未来5次调度时间

ListAlarmEvent

查询报警事件列表

ListScheduleEvent

查询调度事件列表

ListJobScriptHistory

查询脚本任务历史版本

ListK8sResource

查询k8s资源

ListWorkflowExecutions

查询工作流执行列表

ListWorkflowVersions

查询工作流DAG版本

GetCluster

查询实例基本信息

创建

CreateCluster

创建集群

CreateApp

创建XXL-JOB应用

CreateJob

创建XXL-JOB任务

更新

UpdateCluster

更新集群

UpdateCalendar

更新日历

删除

DeleteCluster

删除集群

DeleteCalendar

删除日历

以下接口支持应用级别,通过Condition实现应用权限隔离,参考示例4

类型

Action

权限说明

是否为只读

创建

CreateJob

创建任务

CreateWorkflow

创建工作流

更新

UpdateApp

更新应用

UpdateJob

更新任务

UpdateJobScript

更新脚本任务的脚本

UpdateWorkflow

更新工作流基本信息

UpdateWorkflowDAG

更新工作流的DAG信息

UpdateWorkflowDAGVersion

更新工作流的DAG版本

删除

DeleteApp

删除应用

DeleteJobs

批量删除任务

DeleteWorkflow

删除单个工作流

DeleteWorkflows

批量删除工作流

运维操作

OperateDesignateExecutors

任务指定机器

OperateDisableJobs

批量禁用任务

OperateEnbaleJobs

批量启用任务

OperateExecuteJob

运行一次任务

OperateRerunJob

重刷任务的历史数据

OperateRetryJobExecution

重跑失败的任务执行记录

OperateStopJobExecution

停止正在运行的任务执行记录

OperateBackfillWorkflow

对工作流进行补数据操作

OperateDisableWorkflows

批量禁用工作流

OperateEnableWorkflows

批量启用工作流

OperateExecuteWorkflow

运行一次工作流

OperateHoldJobExecution

挂起还未执行的任务实例

OperateHoldWorkflowExecution

将工作流实例中还未执行的任务实例挂起

OperateMarkSuccessJobExecution

将任务实例标记为成功状态

OperateMarkSuccessWorkflowExecution

将工作流实例标记为成功状态

OperateRetryWorkflowExecution

重跑工作流实例中失败的节点

OperateSkipJobExecution

跳过任务实例

OperateStopWorkflowExecution

停止正在运行的工作流实例

OperateUnholdJobExecution

将挂起状态的任务实例恢复执行

OperateUnholdWorkflowExecution

将挂起状态的工作流实例恢复执行

OperateUnskipJobExecution

将跳过状态的任务实例恢复执行

自定义权限策略示例

示例1:授予RAM用户对实例xxljob-0pp1j8om80a的读写权限。

{
  "Statement": [
    {
      "Action": [
        "schedulerx3:ListClusters",
        "schedulerx3:ListClusterVersions"
      ],
      "Resource": "acs:schedulerx3:*:*:*",
      "Effect": "Allow"
    },
    {
      "Action": "schedulerx3:*",
      "Resource": "acs:schedulerx3:*:*:cluster/xxljob-0pp1j8om80a",
      "Effect": "Allow"
    }
  ],
  "Version": "1"
}

示例2:授予RAM用户对实例xxljob-0pp1j8om80a的只读权限。

{
  "Statement": [
    {
      "Action": [
        "schedulerx3:ListClusters",
        "schedulerx3:ListClusterVersions"
      ],
      "Resource": "acs:schedulerx3:*:*:*",
      "Effect": "Allow"
    },
    {
      "Action": [
        "schedulerx3:List*",
        "schedulerx3:Get*"
      ],
      "Resource": "acs:schedulerx3:*:*:cluster/xxljob-0pp1j8om80a",
      "Effect": "Allow"
    }
  ],
  "Version": "1"
}

示例3:授予RAM用户对所有XXL-JOB实例的只读权限。

{
  "Statement": [
    {
      "Action": [
        "schedulerx3:ListClusters",
        "schedulerx3:ListClusterVersions"
      ],
      "Resource": "acs:schedulerx3:*:*:*",
      "Effect": "Allow"
    },
    {
      "Action": [
        "schedulerx3:List*",
        "schedulerx3:Get*"
      ],
      "Resource": "acs:schedulerx3:*:*:cluster/*",
      "Effect": "Allow"
    }
  ],
  "Version": "1"
}

示例4:授予RAM用户对实例xxljob-7076602169e应用testApp-prodtestApp-gray的权限。

{
  "Statement": [
    {
      "Action": [
        "schedulerx3:ListClusters",
        "schedulerx3:ListClusterVersions"
      ],
      "Resource": "acs:schedulerx3:*:*:*",
      "Effect": "Allow"
    },
    {
      "Action": [
        "schedulerx3:List*",
        "schedulerx3:Get*"
      ],
      "Resource": "acs:schedulerx3:*:*:cluster/xxljob-7076602169e",
      "Effect": "Allow"
    },
    {
      "Action": [
        "schedulerx3:Create*",
        "schedulerx3:Delete*",
        "schedulerx3:Update*",
        "schedulerx3:Operate*"
      ],
      "Resource": "acs:schedulerx3:*:*:cluster/xxljob-7076602169e",
      "Effect": "Allow",
      "Condition": {
        "StringEquals": {
          "schedulerx3:AppName": [
            "testApp-prod",
            "testApp-gray"
          ]
        }
      }
    }
  ],
  "Version": "1"
}

云监控只读策略

XXL-JOB默认集成了云监控,需给RAM子账号授予只读访问云监控的系统策略,否则在基本信息中无法看到调度统计大盘。

  1. 使用RAM管理员登录RAM控制台

  2. 在左侧导航栏权限管理 > 授权页面,单击新增授权,选择授权主体RAM子账号,授权AliyunCloudMonitorReadOnlyAccess云监控只读策略。

    image