This is an automated email from the ASF dual-hosted git repository.

feiwang pushed a commit to branch branch-1.11
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/branch-1.11 by this push:
     new 53325bfa10 [KYUUBI #7313] If the k8s application is pending, audit the 
status as well
53325bfa10 is described below

commit 53325bfa10edb63acb008c5c4b14683c0d0f2237
Author: Wang, Fei <[email protected]>
AuthorDate: Fri Feb 6 09:39:18 2026 -0800

    [KYUUBI #7313] If the k8s application is pending, audit the status as well
    
    ### Why are the changes needed?
    
    I saw that, a pod pending for 3 hours.
    ```
    /var/log/hadoop/kyuubi/audit/k8s-audit.log.2026-01-23-08.gz::2026-01-23 
08:09:31.356 INFO [-935552520-pool-3-thread-2861] 
org.apache.kyuubi.engine.KubernetesApplicationAuditLogger: eventType=UPDATE   
label=cb370310-9c4c-4982-817e-85f4f6c031a9      context=kube-apiserver-a-spark  
namespace=dls-prod      
pod=kyuubi-hadp-adi-hadp-w-md-tbl-location-w-muso-0-ae7bd346-20260123-stm-cb370310-9c4c-4982-817e-85f4f6c031a9-driver
   podState=Pending        containers=[]   appId=spark-f67cc33544654 [...]
    /var/log/hadoop/kyuubi/audit/k8s-audit.log.2026-01-23-11.gz::2026-01-23 
11:09:50.121 INFO [-935552520-pool-3-thread-2902] 
org.apache.kyuubi.engine.KubernetesApplicationAuditLogger: eventType=UPDATE   
label=cb370310-9c4c-4982-817e-85f4f6c031a9      context=kube-apiserver-a-spark  
namespace=dls-prod      
pod=kyuubi-hadp-adi-hadp-w-md-tbl-location-w-muso-0-ae7bd346-20260123-stm-cb370310-9c4c-4982-817e-85f4f6c031a9-driver
   podState=Pending        containers=[]   appId=spark-f67cc33544654 [...]
    ```
    
    However, the audit log did not record that why the pod pending for so long 
time.
    
    So, I think we should check the pod state if pod is pending.
    
    Also, for yarn app, it would also return the app pending reason for example 
waiting for am allocation.
    ### How was this patch tested?
    
    Code review.
    
    ### Was this patch authored or co-authored using generative AI tooling?
    
    No.
    
    Closes #7313 from turboFei/audit_k8s_pending.
    
    Closes #7313
    
    1faff5efa [Wang, Fei] comments
    b456a8440 [Wang, Fei] If the k8s application is pending, audit the status 
as well
    
    Authored-by: Wang, Fei <[email protected]>
    Signed-off-by: Wang, Fei <[email protected]>
    (cherry picked from commit 2037881ff7c2a32efdcc22bca3e427eb5c0780b1)
    Signed-off-by: Wang, Fei <[email protected]>
---
 .../org/apache/kyuubi/engine/KubernetesApplicationOperation.scala   | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
index 703d223d5b..0160f9077b 100644
--- 
a/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
+++ 
b/kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala
@@ -660,7 +660,9 @@ object KubernetesApplicationOperation extends Logging {
       case None => podAppState
     }
     val applicationError = {
-      if (ApplicationState.isFailed(applicationState, supportPersistedAppState 
= true)) {
+      if (ApplicationState.isFailed(
+          applicationState,
+          supportPersistedAppState = true) || applicationState == 
ApplicationState.PENDING) {
         val errorMap = containerStatusToBuildAppState.map { cs =>
           Map(
             "Pod" -> podName,
@@ -670,7 +672,7 @@ object KubernetesApplicationOperation extends Logging {
         }.getOrElse {
           Map("Pod" -> podName, "PodStatus" -> pod.getStatus)
         }
-        Some(JsonUtils.toPrettyJson(errorMap.asJava))
+        Some(JsonUtils.toJson(errorMap.asJava))
       } else {
         None
       }

Reply via email to