From 1074a07b214e984bb7593c28b430c36a789ee255 Mon Sep 17 00:00:00 2001 From: nightwhite Date: Tue, 19 Mar 2024 20:59:59 +0800 Subject: [PATCH 1/2] optimize internal network calls (#2) --- server/src/region/cluster/cluster.service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/server/src/region/cluster/cluster.service.ts b/server/src/region/cluster/cluster.service.ts index 3fd6d9c..07de993 100644 --- a/server/src/region/cluster/cluster.service.ts +++ b/server/src/region/cluster/cluster.service.ts @@ -29,6 +29,7 @@ export class ClusterService { const conf = user.kubeconfig const kc = new k8s.KubeConfig() kc.loadFromString(conf) + kc.clusters[0].server = 'https://kubernetes.default.svc.cluster.local' return kc } From 5f603e7a76416b472f40b73203a422450faad042 Mon Sep 17 00:00:00 2001 From: nightwhite Date: Tue, 19 Mar 2024 13:23:32 +0000 Subject: [PATCH 2/2] optimize internal network calls --- server/src/region/cluster/cluster.service.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/src/region/cluster/cluster.service.ts b/server/src/region/cluster/cluster.service.ts index 07de993..174b0e6 100644 --- a/server/src/region/cluster/cluster.service.ts +++ b/server/src/region/cluster/cluster.service.ts @@ -29,7 +29,13 @@ export class ClusterService { const conf = user.kubeconfig const kc = new k8s.KubeConfig() kc.loadFromString(conf) - kc.clusters[0].server = 'https://kubernetes.default.svc.cluster.local' + if (kc.clusters.length > 0) { + const cluster = { + ...kc.clusters[0], + server: 'https://kubernetes.default.svc.cluster.local' + } + kc.clusters = [cluster] + } return kc }