Fix duplicate containerStatuses in Kubernetes app diagnose error output#7486
Open
turboFei wants to merge 1 commit into
Open
Fix duplicate containerStatuses in Kubernetes app diagnose error output#7486turboFei wants to merge 1 commit into
turboFei wants to merge 1 commit into
Conversation
…p diagnose error output When building the application error diagnostic JSON, PodStatus is serialized as the full Kubernetes PodStatus object which already embeds containerStatuses[] internally. ContainerStatus is then separately included as a sibling key — for a single-container pod (e.g. Spark driver), these two fields contain identical data. Fix: clear containerStatuses on the PodStatus object before serializing, in the branch where ContainerStatus is separately present. The POD-mode fallback (no ContainerStatus sibling) is unaffected and retains the full PodStatus. Before: PodStatus.containerStatuses[0] == ContainerStatus (duplicated) After: PodStatus contains only pod-level info (conditions, phase, IPs) ContainerStatus contains the full driver container state
pan3793
approved these changes
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why are the changes needed?
When a Spark-on-Kubernetes application fails,
getApplicationStateAndErrorFromPodbuilds a diagnostic JSON map containing bothPodStatus(the full KubernetesPodStatusobject) andContainerStatus(the specific driver container's status extracted frompod.getStatus.getContainerStatuses).The problem is that
PodStatusalready embedscontainerStatuses[]internally. For a single-container pod (the typical Spark driver),PodStatus.containerStatuses[0]and the top-levelContainerStatusare identical, producing duplicated data in the error output.Before — same container error appears twice:
{ "PodStatus": { "conditions": [...], "containerStatuses": [{ "name": "spark-kubernetes-driver", "state": { "terminated": { "exitCode": 1, "message": "..." } } }] }, "ContainerStatus": { "name": "spark-kubernetes-driver", "state": { "terminated": { "exitCode": 1, "message": "..." } } } }After — clean separation of pod-level and container-level info:
{ "PodStatus": { "conditions": [...], "phase": "Failed", "hostIP": "...", "podIP": "..." }, "ContainerStatus": { "name": "spark-kubernetes-driver", "state": { "terminated": { "exitCode": 1, "message": "..." } } } }How was this patch tested?
Manual verification with a failing Spark-on-Kubernetes job. The diagnostic JSON no longer contains duplicate container status data.
PodStatusretains pod-level fields (conditions,phase,hostIP,podIP,qosClass) andContainerStatusretains the full driver container state with exit code and error message.The POD-mode fallback path (no
ContainerStatussibling) is unaffected — it continues to emit the fullPodStatusincludingcontainerStatuses.Related: https://github.corp.ebay.com/hadoop/kyuubi/pull/868
Was this patch authored or co-authored using generative AI tooling?
Assisted-by: Claude:claude-sonnet-4-6