mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
detect openshift
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
parent
f95c2d1c91
commit
a9614f73cc
@ -60,6 +60,14 @@ export class DistributionDetector extends BaseClusterDetector {
|
|||||||
return { value: "custom", accuracy: 10};
|
return { value: "custom", accuracy: 10};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.isCustom()) {
|
||||||
|
return { value: "custom", accuracy: 10};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (await this.isOpenshift()) {
|
||||||
|
return { value: "openshift", accuracy: 90};
|
||||||
|
}
|
||||||
|
|
||||||
return { value: "unknown", accuracy: 10};
|
return { value: "unknown", accuracy: 10};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -122,4 +130,14 @@ export class DistributionDetector extends BaseClusterDetector {
|
|||||||
protected isK3s() {
|
protected isK3s() {
|
||||||
return this.version.includes("+k3s");
|
return this.version.includes("+k3s");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected async isOpenshift() {
|
||||||
|
try {
|
||||||
|
const response = await this.k8sRequest("");
|
||||||
|
|
||||||
|
return response.paths?.find((api: string) => api === "/apis/project.openshift.io") !== undefined;
|
||||||
|
} catch (e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user