You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@kyuubi.apache.org by "turboFei (via GitHub)" <gi...@apache.org> on 2026/06/02 04:45:16 UTC

[PR] [KYUUBI #7441] Fix duplicate containerStatuses in Kubernetes app diagnose error output [kyuubi]

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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] Fix duplicate containerStatuses in Kubernetes app diagnose error output [kyuubi]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #7486:
URL: https://github.com/apache/kyuubi/pull/7486#discussion_r3439708591


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -664,6 +664,7 @@ object KubernetesApplicationOperation extends Logging {
           applicationState,
           supportPersistedAppState = true) || applicationState == ApplicationState.PENDING) {
         val errorMap = containerStatusToBuildAppState.map { cs =>
+          pod.getStatus.setContainerStatuses(Seq.empty.asJava)

Review Comment:
   I’m a bit concerned about mutating the pod object here. It might be safer to filter or mask containerStatuses only when logging, in case any upstream code relies on the original pod status.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] Fix duplicate containerStatuses in Kubernetes app diagnose error output [kyuubi]

Posted by "ruanwenjun (via GitHub)" <gi...@apache.org>.
ruanwenjun commented on code in PR #7486:
URL: https://github.com/apache/kyuubi/pull/7486#discussion_r3439705876


##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -664,6 +664,7 @@ object KubernetesApplicationOperation extends Logging {
           applicationState,
           supportPersistedAppState = true) || applicationState == ApplicationState.PENDING) {
         val errorMap = containerStatusToBuildAppState.map { cs =>
+          pod.getStatus.setContainerStatuses(Seq.empty.asJava)

Review Comment:
   I’m a bit concerned about mutating the pod object here. It might be safer to filter or mask containerStatuses only when logging, in case any upstream code relies on the original pod status.



##########
kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala:
##########
@@ -664,6 +664,7 @@ object KubernetesApplicationOperation extends Logging {
           applicationState,
           supportPersistedAppState = true) || applicationState == ApplicationState.PENDING) {
         val errorMap = containerStatusToBuildAppState.map { cs =>
+          pod.getStatus.setContainerStatuses(Seq.empty.asJava)

Review Comment:
   I’m a bit concerned about mutating the pod object here. It might be safer to filter or mask containerStatuses only when logging, in case any upstream code relies on the original pod status.



-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] Fix duplicate containerStatuses in Kubernetes app diagnose error output [kyuubi]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed pull request #7486: Fix duplicate containerStatuses in Kubernetes app diagnose error output
URL: https://github.com/apache/kyuubi/pull/7486


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org


Re: [PR] Fix duplicate containerStatuses in Kubernetes app diagnose error output [kyuubi]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on PR #7486:
URL: https://github.com/apache/kyuubi/pull/7486#issuecomment-6511860728

   Thanks for the PR! This PR is being closed due to inactivity. This isn't a judgement on the merit of the PR in any way. If this is still an issue with the latest version of Kyuubi, please reopen it and ask a committer to remove the Stale tag!
   
   Thank you for using Kyuubi!


-- 
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: notifications-unsubscribe@kyuubi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@kyuubi.apache.org
For additional commands, e-mail: notifications-help@kyuubi.apache.org