Volcano Job API 设计与实践:多任务规格、状态机与生命周期策略全解析
Volcano Job API 设计与实践:多任务规格、状态机与生命周期策略全解析
本文基于 Volcano 官方设计文档 Job API,结合当前仓库的类型定义(job.go)、webhook 校验实现(admit_job.go)与 Job 控制器状态机(factory.go)源码,系统讲解 Volcano Job 这一批处理核心对象的 API 设计:多 Pod 模板、任务输入/输出、阶段状态机、错误处理策略,以及与准入校验、Gang 调度、优先级、插件等特性的交互方式。读完本文,你将能够独立编写、校验并深入理解一个 Volcano Job 从提交到运行完成的完整生命周期。
设计动机与范围
Job 是 Volcano 中高吞吐量(high performance workload)类负载的基础对象。传统 Kubernetes 中,一个 TensorFlow 训练任务(ps/worker 两类角色)或 Spark 作业(driver/executor 两类角色)需要借助多个独立 Workload 拼装,无法作为一个整体被调度、回收或重启。Volcano 的 Job 对象将"一组逻辑上关联、生命周期上耦合的 Pod"抽象为单一 CRD,使其能够整体进入队列、整体 gang 调度、整体故障恢复。
该设计文档明确了能力边界:
- 范围内(In Scope):定义 Job 的 API;定义 Job 的行为;明确 Job 与其他特性的交互;
- 范围外(Out of Scope):卷(Volume)的完整管理——卷管理不在 Job 管理特性范围内,Job 只声明式地引用数据;任务间的网络寻址(addressing)——由其他项目(如 svc 插件对应的服务发现机制)单独描述。
Job 对象总体结构
Job 的定义遵循 Kubernetes 惯例,由 Spec(期望行为)与 Status(当前状态)组成,并带 TypeMeta/ObjectMeta 标准字段。Job 的 CRD 注册在 batch.volcano.sh/v1alpha1 组下,从 job.go 的 kubebuilder 注解可以看到其资源路径为 jobs、短名为 vcjob/vj,且支持 status 子资源:
// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=jobs,shortName=vcjob;vj
// +kubebuilder:subresource:status
// Job defines the volcano job.
type Job struct {
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
// Specification of the desired behavior of the volcano job, including the minAvailable
// +optional
Spec JobSpec `json:"spec,omitempty" protobuf:"bytes,2,opt,name=spec"`
// Current status of the volcano Job
// +optional
Status JobStatus `json:"status,omitempty" protobuf:"bytes,3,opt,name=status"`
}
JobList 则是标准的列表对象(job.go):
// +kubebuilder:object:root=true
// JobList defines the list of jobs.
type JobList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
Items []Job `json:"items" protobuf:"bytes,2,rep,name=items"`
}
下文按设计文档的脉络逐一展开 JobSpec 的核心能力。
多 Pod 模板:spec.tasks
高性能计算任务通常包含不同类型的角色,例如 TensorFlow(ps/worker)、Spark(driver/executor)。为此 Job 引入 tasks 字段(设计文档早期写作 taskSpecs,当前 API 的 json tag 为 tasks),支持在同一个 Job 内声明多个 Pod 模板:
// TaskSpec specifies the task specification of Job.
type TaskSpec struct {
// Name specifies the name of tasks
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
// Replicas specifies the replicas of this TaskSpec in Job
Replicas int32 `json:"replicas,omitempty" protobuf:"bytes,2,opt,name=replicas"`
// Specifies the pod that will be created for this TaskSpec
// when executing a Job
Template v1.PodTemplateSpec `json:"template,omitempty" protobuf:"bytes,4,opt,name=template"`
// Specifies the lifecycle of task
// +optional
Policies []LifecyclePolicy `json:"policies,omitempty" protobuf:"bytes,5,opt,name=policies"`
}
JobController 依据 spec.tasks 中每个任务的 template 与 replicas 创建 Pod,并将所创建 Pod 的 OwnerReference 指向该 Job(即 Pod 由 Job 控制、随 Job 回收)。一个多任务模板的示例如下(一个 2 ps + 5 worker 的 TensorFlow 作业):
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: tf-job
spec:
tasks:
- name: "ps"
replicas: 2
template:
spec:
containers:
- name: ps
image: ps-img
- name: "worker"
replicas: 5
template:
spec:
containers:
- name: worker
image: worker-img
从当前源码看,TaskSpec 在原始设计之上又扩展了若干字段,均可选:
MinAvailable *int32:任务级的最小可用副本数,默认等于该任务的Replicas;TopologyPolicy:NUMA 拓扑策略,枚举值none / best-effort / restricted / single-numa-node;MaxRetry int32:任务级最大重试次数,默认 3;DependsOn *DependsOn:任务间依赖(见下文交互章节);PartitionPolicy:将任务副本划分为若干子组的分区策略,需满足Replicas == TotalPartitions * PartitionSize。
这些扩展对应了 Gang 感知驱逐、任务启动顺序等后续设计文档(如 gang-aware-eviction-design.md),但 name + replicas + template + policies 四元组仍是 API 的骨架。
Job 输入/输出:spec.volumes
大多数高性能负载都会处理输入/输出数据。Volcano 用 VolumeSpec 以声明式方式描述 Job 的数据卷,JobController 负责把卷挂载进每个 Task 的 Pod:
// VolumeSpec defines the specification of Volume, e.g. PVC.
type VolumeSpec struct {
// Path within the container at which the volume should be mounted. Must not contain ':'.
MountPath string `json:"mountPath" protobuf:"bytes,1,opt,name=mountPath"`
// defined the PVC name
// +optional
VolumeClaimName string `json:"volumeClaimName,omitempty" protobuf:"bytes,2,opt,name=volumeClaimName"`
// VolumeClaim defines the PVC used by the VolumeMount.
// +optional
VolumeClaim *v1.PersistentVolumeClaimSpec `json:"volumeClaim,omitempty" protobuf:"bytes,3,opt,name=volumeClaim"`
}
在 JobSpec 中通过 Volumes []VolumeSpec 引用。语义规则(源自设计文档):
spec.volumes为nil时,表示用户自行管理数据,Job 不做任何卷操作;- 若某个
VolumeSpec的volumeClaim(内联 PVC 规格)与volumeClaimName(已有 PVC 名称)都为空或对应 PVC 不存在,则对每个 Task/Pod 使用emptyDir卷兜底。
当前 VolumeSpec 实现还增加了 kubebuilder 校验:mountPath 必填且不允许包含 :;volumeClaimName 长度上限 253。另外从 admit_job.go 的更新校验逻辑可以看出一个实现细节:当 volumeClaim 内联给出时,控制器会回填 PVC 名称并清空 volumeClaimName 后再做一致性比较——即内联 PVC 的名称由 Job 控制器维护,而非用户手工同步。
状态与阶段:Phases 和 Conditions
Job 的当前状态由 status.state 承载:phase 给出生命周期的高层摘要,reason 与 message 提供最近一次阶段迁移的原因与人类可读详情。当前实现还附带了 lastTransitionTime(job.go):
// JobState contains details for the current state of the job.
type JobState struct {
// The phase of Job.
// +optional
Phase JobPhase `json:"phase,omitempty" protobuf:"bytes,1,opt,name=phase"`
// Unique, one-word, CamelCase reason for the phase's last transition.
// +optional
Reason string `json:"reason,omitempty" protobuf:"bytes,2,opt,name=reason"`
// Human-readable message indicating details about last transition.
// +optional
Message string `json:"message,omitempty" protobuf:"bytes,3,opt,name=message"`
// Last time the condition transit from one phase to another.
// +optional
LastTransitionTime metav1.Time `json:"lastTransitionTime,omitempty" protobuf:"bytes,4,opt,name=lastTransitionTime"`
}
设计文档定义的阶段枚举(JobPhase)及允许的迁移关系如下。表格中空单元格表示"不允许迁移到该目标阶段":
| From \ To | Pending | Aborted | Running | Completed | Terminated |
|---|---|---|---|---|---|
| Pending | * | * | * | ||
| Aborted | * | * | |||
| Running | * | * | * | * | |
| Completed | * | ||||
| Terminated | * |
Restarting、Aborting、Terminating 是临时态,用于避免竞态:例如 TerminateJobAction 触发后会相继收到多个 PodEvictedEvent,如果 Job 没有先进入 Terminating 这类中间态,这些事件会被重复处理。
当前源码中的完整阶段集合(job.go)在设计文档基础上补充了 Completing(任务满足完成条件、开始清理)与 Failed(重启次数达到 maxRetry 上限):
const (
// Pending is the phase that job is pending in the queue, waiting for scheduling decision
Pending JobPhase = "Pending"
// Aborting is the phase that job is aborted, waiting for releasing pods
Aborting JobPhase = "Aborting"
// Aborted is the phase that job is aborted by user or error handling
Aborted JobPhase = "Aborted"
// Running is the phase that minimal available tasks of Job are running
Running JobPhase = "Running"
// Restarting is the phase that the Job is restarted, waiting for pod releasing and recreating
Restarting JobPhase = "Restarting"
// Completing is the phase that required tasks of job are completed, job starts to clean up
Completing JobPhase = "Completing"
// Completed is the phase that all tasks of Job are completed
Completed JobPhase = "Completed"
// Terminating is the phase that the Job is terminated, waiting for releasing pods
Terminating JobPhase = "Terminating"
// Terminated is the phase that the job is finished unexpected, e.g. events
Terminated JobPhase = "Terminated"
// Failed is the phase that the job is restarted failed reached the maximum number of retries.
Failed JobPhase = "Failed"
)
从源码结构看,阶段并非自由迁移,而是由 Job 控制器中的状态机严格驱动:factory.go 的 NewState 函数按当前 phase 分派到对应的状态处理器,每个状态目录一一对应 pkg/controllers/job/state/ 下的实现文件:
// NewState gets the state from the volcano job Phase.
func NewState(jobInfo *apis.JobInfo) State {
job := jobInfo.Job
switch job.Status.State.Phase {
case vcbatch.Pending:
return &pendingState{job: jobInfo}
case vcbatch.Running:
return &runningState{job: jobInfo}
case vcbatch.Restarting:
return &restartingState{job: jobInfo}
case vcbatch.Terminated, vcbatch.Completed, vcbatch.Failed:
return &finishedState{job: jobInfo}
case vcbatch.Terminating:
return &terminatingState{job: jobInfo}
case vcbatch.Aborting:
return &abortingState{job: jobInfo}
case vcbatch.Aborted:
return &abortedState{job: jobInfo}
case vcbatch.Completing:
return &completingState{job: jobInfo}
}
// It's pending by default.
return &pendingState{job: jobInfo}
}
State 接口统一暴露 Execute(act Action) 方法,各状态内部只接受符合迁移表的 Action(AbortJob、RestartJob、TerminateJob、ResumeJob、CompleteJob、SyncJob 等),从而在代码层面保证了设计文档中阶段迁移矩阵的约束。未识别的阶段默认按 Pending 处理。
JobStatus 除 state 外还提供各阶段 Pod 计数。当前实现(job.go)的完整字段为:
| 字段 | 含义 |
|---|---|
state |
当前 JobState(phase + reason + message + lastTransitionTime) |
minAvailable |
该 Job 实际生效的最小可用 Pod 数 |
taskStatusCount |
按任务名统计的各 Pod 阶段计数(map: taskName → phase 计数) |
pending / running / succeeded / failed |
各阶段 Pod 总数 |
terminating / unknown |
Terminating / Unknown 阶段 Pod 数 |
version |
作业当前版本(重启递增) |
retryCount |
Job 累计重试次数(配合 maxRetry) |
runningDuration |
从 Running 到完成的时长 |
controlledResources |
Job 控制的其他资源(如 Service、ConfigMap)清单 |
conditions |
导致当前状态的 JobCondition 列表(含 status 与 lastTransitionTime) |
错误处理:LifecyclePolicy
Job 创建后会发生多种事件:Pod 成功、Pod 失败、Pod 被驱逐等,其中部分事件对 Job 是致命的(如 MPI Job 中任一 Pod 失败)。为此引入 LifecyclePolicy,以"事件 → 动作"的形式让用户按框架语义配置容错行为。
事件(Event)枚举,当前实现在 events.go:
const (
// AllEvents means all event
AllEvents Event = "*"
// PodFailedEvent is triggered if Pod was failed
PodFailedEvent Event = "PodFailed"
// PodEvictedEvent is triggered if Pod was deleted
PodEvictedEvent Event = "PodEvicted"
// JobUnknownEvent is triggered when part of pods can't be scheduled
// while some are already running in gang-scheduling case
JobUnknownEvent Event = "Unknown"
// OutOfSyncEvent is triggered if Pod/Job were updated
OutOfSyncEvent Event = "OutOfSync"
// CommandIssuedEvent is triggered if a command is raised by user
CommandIssuedEvent Event = "CommandIssued"
// TaskCompletedEvent is triggered if the 'Replicas' amount of pods in one task are succeed
TaskCompletedEvent Event = "TaskCompleted"
)
动作(Action)枚举,当前实现在 actions.go:
const (
// AbortJobAction: all Pod of Job will be evicted, and no Pod will be recreated
// (the job can be resumed later via ResumeJob)
AbortJobAction Action = "AbortJob"
// RestartJobAction: the whole job will be restarted
RestartJobAction Action = "RestartJob"
// TerminateJobAction: the job is terminated and can not be resumed
TerminateJobAction Action = "TerminateJob"
// CompleteJobAction: unfinished pods will be killed, job completed
CompleteJobAction Action = "CompleteJob"
// ResumeJobAction: resume an aborted job
ResumeJobAction Action = "ResumeJob"
// SyncJobAction: sync Job/Pod status
SyncJobAction Action = "SyncJob"
)
策略结构体 LifecyclePolicy(job.go):
// LifecyclePolicy specifies the lifecycle and error handling of task and job.
type LifecyclePolicy struct {
// The action that will be taken to the PodGroup according to Event.
Action v1alpha1.Action `json:"action,omitempty" protobuf:"bytes,1,opt,name=action"`
// The Event recorded by scheduler; the controller takes actions according to this Event.
Event v1alpha1.Event `json:"event,omitempty" protobuf:"bytes,2,opt,name=event"`
// The Events recorded by scheduler (multiple events per policy).
// +optional
Events []v1alpha1.Event `json:"events,omitempty" protobuf:"bytes,3,opt,name=events"`
// The exit code of the pod container, controller will take action according to this code.
// Note: only one of `Event` or `ExitCode` can be specified.
// +optional
ExitCode *int32 `json:"exitCode,omitempty" protobuf:"bytes,4,opt,name=exitCode"`
// Timeout is the grace period for controller to take actions.
// Default to nil (take action immediately).
// +optional
Timeout *metav1.Duration `json:"timeout,omitempty" protobuf:"bytes,5,opt,name=timeout"`
}
JobSpec 与 TaskSpec 都包含 policies 字段,二者是默认值 + 覆盖关系:spec.policies 是 Job 级默认策略,spec.tasks[i].policies 会覆盖对应任务的默认策略。
示例一:机器学习训练任务,任一任务失败/被驱逐即重启整个 Job。 由于所有任务都不单独设置策略,全部任务都继承 Job 级 event: * → RestartJob:
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: tf-job
spec:
# If any event here, restart the whole job.
policies:
- event: *
action: RestartJob
tasks:
- name: "ps"
replicas: 1
template:
spec:
containers:
- name: ps
image: ps-img
- name: "worker"
replicas: 5
template:
spec:
containers:
- name: worker
image: worker-img
示例二:Spark 这类大数据框架的差异化容错。 driver 失败则重启整个 Job;executor 失败则仅靠 Pod 自身的 restartPolicy: OnFailure 原地重启,不牵连整个作业:
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: spark-job
spec:
tasks:
- name: "driver"
replicas: 1
policies:
- event: *
action: RestartJob
template:
spec:
containers:
- name: driver
image: driver-img
- name: "executor"
replicas: 5
template:
spec:
containers:
- name: executor
image: executor-img
restartPolicy: OnFailure
值得注意的演进点:当前实现除了 Event,还支持按容器退出码(ExitCode)触发策略,以及一条策略关联多个事件(Events)。此外 spec.maxRetry(默认 3,job.go)限制了"重启"这类动作的总次数,超过后 Job 进入 Failed 阶段——这是设计文档发布后为 RestartJob 引入的熔断机制。
与其他特性的交互
Admission 校验
设计文档要求准入校验必须保证以下预期行为:
spec.minAvailable<= sum(spec.tasks.replicas);spec.tasks数组中无重复的 task 名;LifecyclePolicy数组(Job 级与 Task 级)中无重复的事件处理器。
当前实现在 admit_job.go 的 validateJobCreate 中落地,并通过 ValidatingWebhook(/jobs/validate,webhook 名 validatejob.volcano.sh)拦截 Create/Update 请求。除上述三项外,实际校验集合还包括:
- 未声明任何 task 时直接拒绝("No task specified in job spec");
- 启用了 MPI 插件时,必须能按插件参数找到 master 任务("The specified mpi master task was not found");
- 生成的 Pod 名(
job-taskName-index规则)必须通过 Kubernetes 限定名长度校验(validateK8sPodNameLength); - 每个 task 的
template走 Kubernetes 原生ValidatePodTemplate校验; spec.plugins中的插件名必须在插件注册表中存在("unable to find job plugin");- 引用的
spec.queue必须存在且状态为Open,且不能提交到root队列或非叶子队列(层级队列场景); - 若任务间声明了
DependsOn依赖,依赖图必须是有向无环图(DAG),否则拒绝。
更新操作的约束(validateJobUpdate)更为严格:不能增删 task,除 minAvailable、tasks[*].replicas 与 PriorityClassName 之外的 spec 字段不可变更——从源码结构看,这正是当前"作业扩缩容"能力(scale up/down)所允许的唯一可变面。
CoScheduling(Gang 调度)
Gang 调度是 TF、MPI 等负载的刚需:要么全体就绪,要么全体不启动。spec.minAvailable 指明"至少多少个 Pod 一起被调度":
- 默认值为 sum(
spec.tasks.replicas); - 准入 webhook 校验
spec.minAvailable不得超过总副本数,否则拒绝创建; - 若
spec.minAvailable< 总副本数,超出的 Pod 会被随机创建,如需按序创建应使用任务优先级机制。
示例(1 ps + 5 worker,minAvailable: 6 即全量 gang):
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: tf-job
spec:
# minAvailable to run job
minAvailable: 6
tasks:
- name: "ps"
replicas: 1
template:
spec:
containers:
- name: "ps"
image: "ps-img"
- name: "worker"
replicas: 5
template:
spec:
containers:
- name: "worker"
image: "worker-img"
任务内优先级:Task Priority within Job
除多模板外,同一 Job 内不同任务还可以有不同优先级。Volcano 复用 Pod 模板的 PriorityClass 表达任务优先级。示例:Spark 作业 1 driver + 5 executor,driver 使用更高优先级的 master-pri,minAvailable: 3 表示资源不足时调度器保证"1 driver + 2 executor"也能先成 gang 启动:
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: spark-job
spec:
minAvailable: 3
tasks:
- name: "driver"
replicas: 1
template:
spec:
priorityClass: "master-pri"
containers:
- name: driver
image: driver-img
- name: "executor"
replicas: 5
template:
spec:
containers:
- name: executor
image: executor-img
设计文档特别提示了一个竞态:虽然调度器会优先调度高优先级 Pod,但不同 kubelet 之间仍存在低优先级 Pod 先启动的可能;任务间依赖(即当前 API 中的 spec.tasks<a href="https://link.gitcode.com/i/b8c830d40e67510885af0b01fd82cae5" target="_blank">].dependsOn 字段,见 [DependsOn 定义)正是为处理这类竞态而引入的后继能力。
作业间资源共享
默认 spec.minAvailable 等于总副本数,即全量 gang;若显式调小 minAvailable,超出该值的 Pod 将在作业之间共享资源(无需独占),提升集群利用率。示例与上一节相同(minAvailable: 3 时,第 4~6 个 executor 属于可共享部分)。
Job 插件:spec.plugins
TensorFlow、MPI、MxNet 等框架作业还需要设置环境变量、任务间通信、免密 SSH 登录等"胶水"工作。Volcano 提供 Job API 插件,让用户聚焦核心业务。设计文档发布时提供了三个内置插件,每个插件都有参数,未提供时使用默认值:
- env:向每个容器注入
VK_TASK_INDEX(当前实现同时注入VC_TASK_INDEX),作为容器身份索引——见 env 插件 及其常量定义 const.go; - svc:为任务创建 Service 与
*.host域名,使 Pod 之间可通信; - ssh:配置免密 SSH,支持
mpirun/mpiexec等命令。
插件以 map[插件名]参数列表 挂在 spec.plugins 上,完整示例(MPI 作业,master 驱逐后重启整个 Job):
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: mpi-job
spec:
minAvailable: 2
schedulerName: volcano
policies:
- event: PodEvicted
action: RestartJob
plugins:
ssh: []
env: []
svc: []
tasks:
- replicas: 1
name: mpimaster
template:
spec:
containers:
image: mpi-image
name: mpimaster
- replicas: 2
name: mpiworker
template:
spec:
containers:
image: mpi-image
name: mpiworker
插件的可用性与参数语义有专门的用户指南:如何配置插件、SSH 插件、SVC 插件、ENV 插件、MPI 插件。
附录:JobSpec 完整字段速查
以当前源码 job.go 为准,JobSpec 的全部字段及说明如下("设计文档"列标注该字段是否出自原始 Job API 设计):
| 字段 | 类型 / 默认值 | 说明 | 设计文档 |
|---|---|---|---|
schedulerName |
string,最大 63 字符 | tasks.template.spec.schedulerName 的默认值 |
是 |
minAvailable |
int32,默认=各 task 副本之和 | 该 Job 至少需要同时调度的 Pod 数(Gang 规模) | 是 |
volumes |
[]VolumeSpec | Job 级输入/输出卷声明(mountPath + PVC 名称或内联 PVC 规格) | 是 |
tasks |
[]TaskSpec(MinItems=1) | 任务列表,每项含 name/replicas/template/policies 及扩展字段 | 是 |
policies |
[]LifecyclePolicy | Job 级默认生命周期策略,可被 TaskSpec.policies 覆盖 | 是 |
plugins |
map[string][]string | 插件名 → 参数列表(env/svc/ssh/mpi 等) | 是 |
queue |
string,默认 default |
作业提交的调度队列 | 是 |
maxRetry |
int32,默认 3 | 作业重试上限,超限进入 Failed |
是 |
runningEstimate |
*Duration | 用户预估的运行时长 | 否 |
ttlSecondsAfterFinished |
*int32 | Completed/Failed 后自动删除 Job 的宽限期 | 否 |
priorityClassName |
string | 作业级优先级类 | 否 |
minSuccess |
*int32,最小 1 | "最小成功 Pod 数"完成条件(min-success 特性) | 否 |
networkTopology |
*NetworkTopologySpec | 网络拓扑约束(mode: hard/soft,可配最高允许跨层) | 否 |
TaskSpec 扩展字段(设计文档之外的演进):
| 字段 | 说明 |
|---|---|
minAvailable |
任务级最小可用副本数,默认等于该任务 replicas |
topologyPolicy |
NUMA 策略:none/best-effort/restricted/single-numa-node |
maxRetry |
任务级重试上限,默认 3 |
dependsOn |
依赖的其他任务名列表 + iteration(any/all),构成 DAG 启动顺序 |
partitionPolicy |
分区策略:totalPartitions、partitionSize、minPartitions、嵌套 networkTopology |
一个可直接参考的完整 Job 样例见 example/job.yaml。
小结
Volcano 的 Job API 围绕一个核心思想展开:把"一组逻辑耦合的 Pod"提升为一等调度对象。其骨架由四部分组成——多模板 tasks 表达异构角色、volumes 声明式接入数据、minAvailable 定义 Gang 边界、policies(LifecyclePolicy)把 Pod 级事件翻译为作业级动作。围绕骨架,准入 webhook 保证提交的合法性,控制器内的状态机(state 目录)严格执行阶段迁移表,内置插件消化框架胶水逻辑。原始设计文档中关于"任务间依赖处理 kubelet 竞态"的展望,也已落地为当前的 dependsOn 字段并在 webhook 中做 DAG 校验。理解这套 API 与源码的对应关系,是编写、排障和扩展 Volcano 批处理负载的基础。