turboFei opened a new pull request, #7486:
URL: https://github.com/apache/kyuubi/pull/7486

   ## Why
   
   When a Spark-on-Kubernetes application fails, 
`getApplicationStateAndErrorFromPod` builds a diagnostic JSON map containing:
   
   - `PodStatus` → the full Kubernetes `PodStatus` object
   - `ContainerStatus` → the specific driver container's status, extracted from 
`pod.getStatus.getContainerStatuses`
   
   The problem is that `PodStatus` already embeds `containerStatuses[]` 
internally. For a single-container pod (the typical Spark driver), 
`PodStatus.containerStatuses[0]` and `ContainerStatus` at the top level are 
identical objects serialized twice, producing a confusing and bloated 
diagnostic output.
   
   **Before** (duplicated — both blocks contain identical stack traces and 
terminated state):
   ```json
   {
     "PodStatus": {
       "conditions": [...],
       "containerStatuses": [{ "name": "spark-kubernetes-driver", "state": { 
"terminated": { ... } } }]
     },
     "ContainerStatus": { "name": "spark-kubernetes-driver", "state": { 
"terminated": { ... } } }
   }
   ```
   
   **After** (clean separation):
   ```json
   {
     "PodStatus": {
       "conditions": [...],
       "phase": "Failed",
       "hostIP": "...",
       "podIP": "..."
     },
     "ContainerStatus": { "name": "spark-kubernetes-driver", "state": { 
"terminated": { ... } } }
   }
   ```
   
   ## What
   
   Clear `containerStatuses` on the `PodStatus` object before serializing, only 
in the branch where `ContainerStatus` is separately present as a sibling key. 
The POD-mode fallback path (no `ContainerStatus`) is unaffected and retains the 
full `PodStatus` including `containerStatuses`.
   
   ## Testing
   
   - Manual verification with a failing Spark-on-Kubernetes job confirms the 
diagnostic JSON no longer contains duplicate container status data
   - `PodStatus` retains pod-level fields: `conditions`, `phase`, `hostIP`, 
`podIP`, `qosClass`
   - `ContainerStatus` retains the full driver container state with exit code 
and error message


-- 
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