From 8fba2ed466845c8db4c9f326d9bc84c691f5891c Mon Sep 17 00:00:00 2001 From: Tim deBoer Date: Tue, 12 Sep 2023 10:52:52 -0400 Subject: [PATCH] fix: show correct pod deletion status Kubernetes pods never go into a deletion/termination status - they stay in 'running' state while the containers are given time to shut down, then the pod just disappears. Kubectl uses the deletion timestamp to show these pod as Terminating: https://github.com/kubernetes/kubernetes/blob/a9f6b93b62a98598913180c640ab044c85a6718b/pkg/printers/internalversion/printers.go#L779C39-L779C39 This change uses the same mechanism as kubectl to detect this condition, but uses our existing DELETING state. Also removed a duplicate comment I noticed. Partial fix for issue #3529, the rest is showing deletion in the UI better. Signed-off-by: Tim deBoer --- packages/main/src/plugin/kubernetes-client.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/main/src/plugin/kubernetes-client.ts b/packages/main/src/plugin/kubernetes-client.ts index 33fcc6e8779..eba83c9dfea 100644 --- a/packages/main/src/plugin/kubernetes-client.ts +++ b/packages/main/src/plugin/kubernetes-client.ts @@ -87,7 +87,7 @@ function toPodInfo(pod: V1Pod, contextName?: string): PodInfo { Name: pod.metadata?.name || '', Namespace: pod.metadata?.namespace || '', Networks: [], - Status: pod.status?.phase || '', + Status: pod.metadata?.deletionTimestamp ? 'DELETING' : pod.status?.phase || '', engineId: contextName ?? 'kubernetes', engineName: 'k8s', kind: 'kubernetes', @@ -160,7 +160,6 @@ export class KubernetesClient { this.configurationRegistry.registerConfigurations([kubeconfigConfigurationNode]); // grab the value from the configuration - // grab value const kubernetesConfiguration = this.configurationRegistry.getConfiguration('kubernetes'); const userKubeconfigPath = kubernetesConfiguration.get('Kubeconfig'); if (userKubeconfigPath) {