mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
Detect rancher distros (#1617)
Signed-off-by: Lauri Nevala <lauri.nevala@gmail.com>
This commit is contained in:
parent
6d5e18ea7d
commit
2062b376a0
@ -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");
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user