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:
a9f6b93b62/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 <git@tdeboer.ca>
This commit is contained in:
Tim deBoer 2023-09-12 10:52:52 -04:00
parent 4259322d63
commit 8fba2ed466

View file

@ -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<string>('Kubeconfig');
if (userKubeconfigPath) {