From 2062b376a099a8115e154e5bd5d7854ca52d80b2 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Wed, 2 Dec 2020 16:27:00 +0200 Subject: [PATCH 1/5] Detect rancher distros (#1617) Signed-off-by: Lauri Nevala --- .../distribution-detector.ts | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index ba56f0ed0d..580229f63f 100644 --- a/src/main/cluster-detectors/distribution-detector.ts +++ b/src/main/cluster-detectors/distribution-detector.ts @@ -8,8 +8,12 @@ export class DistributionDetector extends BaseClusterDetector { public async detect() { this.version = await this.getKubernetesVersion(); - if (await this.isRancher()) { - return { value: "rancher", accuracy: 80}; + if (this.isRke()) { + return { value: "rke", accuracy: 80}; + } + + if (this.isK3s()) { + return { value: "k3s", accuracy: 80}; } if (this.isGKE()) { @@ -87,13 +91,11 @@ export class DistributionDetector extends BaseClusterDetector { return this.version.includes("+"); } - protected async isRancher() { - try { - const response = await this.k8sRequest(""); + protected isRke() { + return this.version.includes("-rancher"); + } - return response.data.find((api: any) => api?.apiVersion?.group === "meta.cattle.io") !== undefined; - } catch (e) { - return false; - } + protected isK3s() { + return this.version.includes("+k3s"); } } \ No newline at end of file From b128f550060beaee426d7d5e82ced8f44d8f96b2 Mon Sep 17 00:00:00 2001 From: Lauri Nevala Date: Wed, 2 Dec 2020 16:44:44 +0200 Subject: [PATCH 2/5] Add run tests step to Windows pipeline (#1610) Signed-off-by: Lauri Nevala --- .azure-pipelines.yml | 6 ++++-- src/main/__test__/kubeconfig-manager.test.ts | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index d7515f4398..8db2859598 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -41,10 +41,12 @@ jobs: displayName: Generate npm package - script: make -j2 build-extensions displayName: Build bundled extensions - - script: make integration-win - displayName: Run integration tests + - script: make test + displayName: Run tests - script: make test-extensions displayName: Run In-tree Extension tests + - script: make integration-win + displayName: Run integration tests - script: make build condition: "and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'))" displayName: Build diff --git a/src/main/__test__/kubeconfig-manager.test.ts b/src/main/__test__/kubeconfig-manager.test.ts index 5a5eca9548..89c882b109 100644 --- a/src/main/__test__/kubeconfig-manager.test.ts +++ b/src/main/__test__/kubeconfig-manager.test.ts @@ -32,6 +32,7 @@ import { getFreePort } from "../port"; import fse from "fs-extra"; import { loadYaml } from "@kubernetes/client-node"; import { Console } from "console"; +import * as path from "path"; console = new Console(process.stdout, process.stderr); // fix mockFS @@ -84,7 +85,7 @@ describe("kubeconfig manager tests", () => { const kubeConfManager = await KubeconfigManager.create(cluster, contextHandler, port); expect(logger.error).not.toBeCalled(); - expect(kubeConfManager.getPath()).toBe("tmp/kubeconfig-foo"); + expect(kubeConfManager.getPath()).toBe(`tmp${path.sep}kubeconfig-foo`); const file = await fse.readFile(kubeConfManager.getPath()); const yml = loadYaml(file.toString()); From bcb6f7469bf74f18783022a2e427c1571d6367b9 Mon Sep 17 00:00:00 2001 From: Sebastian Malton Date: Wed, 2 Dec 2020 10:27:27 -0500 Subject: [PATCH 3/5] actually use ResourceQuotaDetails (#1621) Signed-off-by: Sebastian Malton --- .../+config-resource-quotas/resource-quota-details.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx b/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx index 24b35e6b55..8d3d116de7 100644 --- a/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx +++ b/src/renderer/components/+config-resource-quotas/resource-quota-details.tsx @@ -11,7 +11,6 @@ import { LineProgress } from "../line-progress"; import { Table, TableCell, TableHead, TableRow } from "../table"; import { KubeObjectMeta } from "../kube-object/kube-object-meta"; import { kubeObjectDetailRegistry } from "../../api/kube-object-detail-registry"; -import { ReplicaSetDetails } from "../+workloads-replicasets"; interface Props extends KubeObjectDetailsProps { } @@ -103,6 +102,6 @@ kubeObjectDetailRegistry.add({ kind: "ResourceQuota", apiVersions: ["v1"], components: { - Details: (props) => + Details: (props) => } }); From 13914a8bea86f28c4f8f1aba4f0a7f1b1fa78731 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 2 Dec 2020 19:13:32 +0200 Subject: [PATCH 4/5] Detect Mirantis Kubernetes Engine (#1622) Signed-off-by: Jari Kolehmainen --- src/main/cluster-detectors/distribution-detector.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index 580229f63f..49168ebafa 100644 --- a/src/main/cluster-detectors/distribution-detector.ts +++ b/src/main/cluster-detectors/distribution-detector.ts @@ -36,6 +36,10 @@ export class DistributionDetector extends BaseClusterDetector { return { value: "digitalocean", accuracy: 90}; } + if (this.isMirantis()) { + return { value: "mirantis", accuracy: 90}; + } + if (this.isMinikube()) { return { value: "minikube", accuracy: 80}; } @@ -75,6 +79,10 @@ export class DistributionDetector extends BaseClusterDetector { return this.cluster.apiUrl.endsWith("azmk8s.io"); } + protected isMirantis() { + return this.version.includes("-mirantis-") || this.version.includes("-docker-"); + } + protected isDigitalOcean() { return this.cluster.apiUrl.endsWith("k8s.ondigitalocean.com"); } @@ -98,4 +106,4 @@ export class DistributionDetector extends BaseClusterDetector { protected isK3s() { return this.version.includes("+k3s"); } -} \ No newline at end of file +} From 87f1a39dcac274c5cae405abb683a9b10014b8f4 Mon Sep 17 00:00:00 2001 From: Jari Kolehmainen Date: Wed, 2 Dec 2020 19:13:57 +0200 Subject: [PATCH 5/5] Detect Docker Desktop (#1623) Signed-off-by: Jari Kolehmainen --- src/main/cluster-detectors/distribution-detector.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index 49168ebafa..64d2165ab5 100644 --- a/src/main/cluster-detectors/distribution-detector.ts +++ b/src/main/cluster-detectors/distribution-detector.ts @@ -48,6 +48,10 @@ export class DistributionDetector extends BaseClusterDetector { return { value: "microk8s", accuracy: 80}; } + if (this.isDockerDesktop()) { + return { value: "docker-desktop", accuracy: 80}; + } + if (this.isCustom()) { return { value: "custom", accuracy: 10}; } @@ -95,6 +99,10 @@ export class DistributionDetector extends BaseClusterDetector { return this.cluster.contextName.startsWith("microk8s"); } + protected isDockerDesktop() { + return this.cluster.contextName === "docker-desktop"; + } + protected isCustom() { return this.version.includes("+"); }