-
Notifications
You must be signed in to change notification settings - Fork 91
Description
What happened:
If a job not define the .spec.replicatedJobs[0].template.spec.completions
and .spec.replicatedJobs[0].template.spec.completionMode
field , the job can't be distributed by jobset and no error .
What you expected to happen:
If the default value for completionMode is Indexed
, should also define the default value same as parallelism.
How to reproduce it (as minimally and precisely as possible):
Deploy the following JobSet spec:
apiVersion: jobset.x-k8s.io/v1alpha2
kind: JobSet
metadata:
name: success-policy
spec:
# We want to declare our JobSet successful if workers finish.
# If workers finish we should clean up the remaining replicatedJobs.
successPolicy:
operator: All
targetReplicatedJobs:
- workers
replicatedJobs:
- name: leader
replicas: 1
template:
spec:
# Set backoff limit to 0 so job will immediately fail if any pod fails.
backoffLimit: 0
completions: 1
parallelism: 1
template:
spec:
containers:
- name: leader
image: quay.io/openshifttest/hello-openshift:1.2.0
command:
- bash
- -xc
- |
sleep 100
- name: workers
replicas: 1
template:
spec:
backoffLimit: 0
parallelism: 5
template:
spec:
containers:
- name: worker
image: quay.io/openshifttest/hello-openshift:1.2.0
command:
- bash
- -xc
- |
if [[ "$JOB_COMPLETION_INDEX" == "0" ]]; then
for i in $(seq 10 -1 1)
do
echo "Sleeping in $i"
sleep 1
done
exit $(rand 0 1)
fi
The worker job never by deployed , and see logs from the jobset-manager :
2025-09-05T11:26:59Z ERROR Reconciler error {"controller": "jobset", "controllerGroup": "jobset.x-k8s.io", "controllerKind": "JobSet", "JobSet": {"name":"success-policy","namespace":"testzhouy"}, "namespace": "testzhouy", "name": "success-policy", "reconcileID": "1a43fe16-be7d-4075-8fd7-3e674adb1505", "error": "job \"success-policy-workers-0\" creation failed with error: Job.batch \"success-policy-workers-0\" is invalid: spec.completions: Required value: when completion mode is Indexed"} sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).reconcileHandler /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:353 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).processNextWorkItem /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:300 sigs.k8s.io/controller-runtime/pkg/internal/controller.(*Controller[...]).Start.func2.1 /workspace/vendor/sigs.k8s.io/controller-runtime/pkg/internal/controller/controller.go:202
Anything else we need to know?:
Environment:
- Kubernetes version (use
kubectl version
): v1.33.3 - JobSet version (use
git describe --tags --dirty --always
): - Cloud provider or hardware configuration:
- Install tools:
- Others:
Metadata
Metadata
Assignees
Labels
Type
Projects
Status