mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Merge branch 'master' into detect-kind
This commit is contained in:
commit
de3bea4bc6
@ -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
|
||||
|
||||
@ -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<any>(file.toString());
|
||||
|
||||
|
||||
@ -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");
|
||||
}
|
||||
}
|
||||
|
||||
@ -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<ResourceQuota> {
|
||||
}
|
||||
@ -103,6 +102,6 @@ kubeObjectDetailRegistry.add({
|
||||
kind: "ResourceQuota",
|
||||
apiVersions: ["v1"],
|
||||
components: {
|
||||
Details: (props) => <ReplicaSetDetails {...props} />
|
||||
Details: (props) => <ResourceQuotaDetails {...props} />
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user