Repository navigation
Fix pod mutation bug in add_xcom_sidecar and add unit tests for Kubernetes xcom sidecar helper - #68786
Fix pod mutation bug in add_xcom_sidecar and add unit tests for Kubernetes xcom sidecar helper#68786kesem0811 wants to merge 1 commit into
Conversation
|
The tests are welcome, but the one-line change in this PR is doing more than the title and description suggest, and I think it deserves to be the headline. pod_cp = copy.deepcopy(pod)
pod_cp.spec.volumes = pod.spec.volumes or [] # reads the original, not the copy
pod_cp.spec.volumes.insert(0, PodDefaults.VOLUME)Rebinding to the original's list defeats the deepcopy for that attribute, so the
Could you retitle and describe this as the bug fix it is, with the tests as supporting work? The description becomes the squash commit message, and as it stands someone bisecting a pod-mutation problem would never find this commit. Two practical notes, neither about the content. This branch has drifted a long way behind And this and #68788 both edit Drafted-by: Claude Code (Opus 5); reviewed by @potiuk before posting |
|
Thanks for finding and fixing this! The same bug was fixed in #72522, merged on 2026-09-09: it changes only the deep copy and also copies Drafted-by: Claude Code (Opus 5.5); reviewed by @potiuk before posting |
This PR fixes a silent bug in
add_xcom_sidecarwhere thedeepcopycontract was accidentally broken for pods that already contained volumes.Previously,
add_xcom_sidecar(used byKubernetesPodOperatorwhendo_xcom_push=Trueto attach the XCom sidecar and shared volume) inadvertently mutated the caller's original pod due to how the volume list was assigned. This PR fixes the mutation issue and adds comprehensive unit tests to ensureadd_xcom_sidecarbehaves correctly and prevents future regressions.