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()); diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index 7635862eb2..b496f2ce00 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()) { @@ -32,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}; } @@ -44,6 +52,10 @@ export class DistributionDetector extends BaseClusterDetector { return { value: "kind", accuracy: 70}; } + if (this.isDockerDesktop()) { + return { value: "docker-desktop", accuracy: 80}; + } + if (this.isCustom()) { return { value: "custom", accuracy: 10}; } @@ -75,6 +87,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"); } @@ -91,17 +107,19 @@ export class DistributionDetector extends BaseClusterDetector { return this.cluster.contextName.startsWith("kubernetes-admin@kind-"); } + protected isDockerDesktop() { + return this.cluster.contextName === "docker-desktop"; + } + protected isCustom() { 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"); } } 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) => } });