Skip to content

Commit 2037881

Browse files
committed
[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-f67cc33544654d828d36cc9553404a3e appName=hadp-adi-hadp-w-md-t-818abc6d23397c33859c76dff9aa82e7244a92ba appState=PENDING appError='' /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-f67cc33544654d828d36cc9553404a3e appName=hadp-adi-hadp-w-md-t-818abc6d23397c33859c76dff9aa82e7244a92ba appState=PENDING appError='' ``` 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 1faff5e [Wang, Fei] comments b456a84 [Wang, Fei] If the k8s application is pending, audit the status as well Authored-by: Wang, Fei <fwang12@ebay.com> Signed-off-by: Wang, Fei <fwang12@ebay.com>
1 parent 73882e5 commit 2037881

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

kyuubi-server/src/main/scala/org/apache/kyuubi/engine/KubernetesApplicationOperation.scala

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,9 @@ object KubernetesApplicationOperation extends Logging {
660660
case None => podAppState
661661
}
662662
val applicationError = {
663-
if (ApplicationState.isFailed(applicationState, supportPersistedAppState = true)) {
663+
if (ApplicationState.isFailed(
664+
applicationState,
665+
supportPersistedAppState = true) || applicationState == ApplicationState.PENDING) {
664666
val errorMap = containerStatusToBuildAppState.map { cs =>
665667
Map(
666668
"Pod" -> podName,
@@ -670,7 +672,7 @@ object KubernetesApplicationOperation extends Logging {
670672
}.getOrElse {
671673
Map("Pod" -> podName, "PodStatus" -> pod.getStatus)
672674
}
673-
Some(JsonUtils.toPrettyJson(errorMap.asJava))
675+
Some(JsonUtils.toJson(errorMap.asJava))
674676
} else {
675677
None
676678
}

0 commit comments

Comments
 (0)