func mutateSpec(tasks []v1alpha1.TaskSpec, basePath string) (patch []patchOperation) {
for index := range tasks {
// add default task name
taskName := tasks[index].Name
if len(taskName) == 0 {
tasks[index].Name = v1alpha1.DefaultTaskSpec
}
}
patch = append(patch, patchOperation{
Op: "replace",
Path: basePath,
Value: tasks,
})
return patch
}
If user not specify the task names of a job, default will be used in mutating stage, but the validating admission controller will reject the Job creation because of duplicate task names.
If user not specify the task names of a job,
defaultwill be used in mutating stage, but the validating admission controller will reject the Job creation because of duplicate task names.