Repository navigation
fix(framework): default unset JobSet volumeClaimPolicies retentionPolicy - #4500
aarushitandon0 wants to merge 1 commit into
Conversation
The JobSet mutating webhook (verbs=create only) sets an unset
volumeClaimPolicies[].retentionPolicy to {whenDeleted: Delete}, and
volumeClaimPolicies is immutable (self == oldSelf). The JobSet plugin's
Build() left retentionPolicy unset, so later server-side applies of the
JobSet (seen on suspend, resume, and resume after Kueue admission) sent
a volumeClaimPolicies value that differed from the stored one. The API
server rejected those updates with "spec.volumeClaimPolicies: Invalid
value: Value is immutable". TorchTune runtimes, which define
volumeClaimPolicies without a retentionPolicy, therefore could not be
suspended or resumed.
Build() now applies the same default the webhook applies on create, so
the applied spec matches the stored spec. An explicitly set
retentionPolicy is left unchanged.
Fixes kubeflow#4494
Signed-off-by: Aarushi Tandon <aarushi.tandon0@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
What this PR does / why we need it:
TrainJobs that use the TorchTune runtimes cannot be suspended or resumed. The JobSet update is rejected with
spec.volumeClaimPolicies: Invalid value: Value is immutable, so the TrainJob and its JobSet go out of sync. For example, the TrainJob showssuspend: truewhile the JobSet keeps running, or the TrainJob is resumed while the JobSet stays suspended.Root cause. In JobSet v0.13.0 (the version in
go.mod):create. WhenvolumeClaimPolicies[].retentionPolicyis unset, it sets it to{whenDeleted: Delete}.volumeClaimPoliciesis immutable (self == oldSelf,+listType=atomic).The TorchTune runtimes define
volumeClaimPolicieswithout aretentionPolicy, andBuild()in the JobSet plugin passed that through as-is. The JobSet was stored with the webhook's default, but later server-side applies sent the policy without it. The API server then rejected those updates, including the ones for suspend and resume.Fix.
Build()now applies the same default that the webhook applies on create (whenDeleted: Delete) to anyvolumeClaimPoliciesentry whoseretentionPolicyis nil. The applied spec then matches the stored spec. An explicitly setretentionPolicyis left unchanged. The change is 10 lines inpkg/runtime/framework/plugins/jobset/jobset.go, plus one newTestBuildcase. It makes no API or CRD changes.Testing
Unit and static checks:
TestBuild/volumeClaimPolicies get the JobSet default retentionPolicy when it is unsetcovers two policies, one unset and one set toRetain. It checks that only the unset one is defaulted.go test -count=1 ./pkg/runtime/framework/plugins/jobset/: 100 PASS, 0 FAIL.make test: 27 packages ok, 0 FAIL.gofmt,go vet: clean.golangci-lintv2.14.0:0 issues.on the package and on the whole repo.test/integration/controller, envtest 1.37.0): 60 of 61 specs passed. The one failure is an[AfterAll]teardown timeout ("timeout waiting for process kube-apiserver to stop"), with novolumeClaimPolicieserrors in the log. I did not run it against master.Live test on kind (Kubernetes v1.37.0, Trainer Helm chart 2.4.0 with the default runtimes, JobSet v0.13.0, Kueue v0.20.7):
busybox sleep 3600and used a tiny public model for the model initializer. The runtimes'volumeClaimPolicieswere left untouched.volumeClaimPolicies ... immutablereconcile errors in the controller log for that TrainJob.torchtune-llama3.2-1b)suspend=false, JobSetsuspend=true, 0 pods, 5 and 3 errorssuspend=false, 2 pods, 0 errorssuspend=true, JobSetsuspend=false, 1 pod still running, 15 errorssuspend=true, 0 pods, 0 errorssuspend=truewith 0 pods, 4 errors after admission (12 while queued)suspend=false, 1 pod, 0 errorsretentionPolicy: {whenDeleted: Retain}RetainretentionPolicy: {}(the API server storeswhenDeleted: Delete)torch-distributed(novolumeClaimPolicies): run, suspend, resumeRelated: #4441 is a different JobSet immutability problem, in
spec.replicatedJobsafter a v2.3 to v2.4 upgrade. This PR doesn't change it.Which issue(s) this PR fixes (optional, in
Fixes #<issue number>, #<issue number>, ...format, will close the issue(s) when PR gets merged):Fixes #4494
Checklist: