From 00d4e7d0e067fae49fbf5daa0ad6376d01949c06 Mon Sep 17 00:00:00 2001 From: E M <5089238+emizzle@users.noreply.github.com> Date: Tue, 9 Jun 2026 20:49:33 +1000 Subject: [PATCH] fix dist tests workflow summary After kubeconfig was replaced with an in-cluster service account, k8sClient was returning null and thus no test summaries were being written to ConfigMaps. This change returns a default Kubeconfig for the k8sClient when one is not passed in an environment variable. --- Tests/DistTestCore/Global.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/Tests/DistTestCore/Global.cs b/Tests/DistTestCore/Global.cs index 83060c52..f0eff4b7 100644 --- a/Tests/DistTestCore/Global.cs +++ b/Tests/DistTestCore/Global.cs @@ -20,10 +20,18 @@ namespace DistTestCore private static IKubernetes? CreateK8sClient() { - var kubeconfig = Environment.GetEnvironmentVariable("KUBECONFIG"); - if (string.IsNullOrEmpty(kubeconfig)) return null; - var config = KubernetesClientConfiguration.BuildConfigFromConfigFile(kubeconfig); - return new Kubernetes(config); + try + { + var kubeconfig = Environment.GetEnvironmentVariable("KUBECONFIG"); + var config = string.IsNullOrEmpty(kubeconfig) + ? KubernetesClientConfiguration.BuildDefaultConfig() + : KubernetesClientConfiguration.BuildConfigFromConfigFile(kubeconfig); + return new Kubernetes(config); + } + catch + { + return null; + } } public Global()