dongjoon-hyun opened a new pull request, #58717:
URL: https://github.com/apache/spark/pull/58717

   ### What changes were proposed in this pull request?
   
   This PR is a backport of #58716 to `branch-4.x`.
   
   This PR aims to use the nested builders of `VolumeBuilder` for all volume 
sources in `MountVolumesFeatureStep`, instead of positional constructors.
   
   | Volume | Before | After |
   |---|---|---|
   | `hostPath` | `new HostPathVolumeSource(hostPath, volumeType)` | 
`withNewHostPath()` ... `endHostPath()` |
   | `persistentVolumeClaim` | `new 
PersistentVolumeClaimVolumeSource(claimName, spec.mountReadOnly)` | 
`withNewPersistentVolumeClaim()` ... `endPersistentVolumeClaim()` |
   | `emptyDir` | `new EmptyDirVolumeSource(medium.getOrElse(""), 
sizeLimit.map(new Quantity(_)).orNull)` | `withNewEmptyDir()` ... 
`endEmptyDir()` |
   | `nfs` | `new NFSVolumeSource(path, null, server)` | `withNewNfs()` ... 
`endNfs()` |
   
   Unlike `master`, `branch-4.x` still uses the positional constructor of 
`EmptyDirVolumeSource` because SPARK-59384 (#58671) is not in `branch-4.x`. 
After this PR, `MountVolumesFeatureStep` in `branch-4.x` is the same as in 
`master`.
   
   ### Why are the changes needed?
   
   Positional constructors of `fabric8` model classes break whenever a new 
Kubernetes version adds a field. For example, `kubernetes-client` 7.9.0 added 
the `mode` field to `EmptyDirVolumeSource`, so SPARK-59384 (#58671) had to 
replace its constructor call in `master`.
   
   Nested builders set each field by name, so future field additions don't 
affect this code. The same style is already used in the module, e.g., 
`withNewEmptyDir()` in `LocalDirsFeatureStep`.
   
   For `branch-4.x`, this also keeps `MountVolumesFeatureStep` the same as in 
`master`, so future backports to this file apply cleanly. The nested builders 
are available in `kubernetes-client` 7.6.1, which `branch-4.x` uses.
   
   ### Does this PR introduce _any_ user-facing change?
   
   No. Each nested builder extends the fluent class of its volume source, so 
the generated volumes are the same as before. The `readOnly` field of the `nfs` 
volume source stays `null` because it isn't set.
   
   ### How was this patch tested?
   
   Pass the CIs with the existing test coverage.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to