diff --git a/src/main/cluster-detectors/distribution-detector.ts b/src/main/cluster-detectors/distribution-detector.ts index b496f2ce00..2279f97e3e 100644 --- a/src/main/cluster-detectors/distribution-detector.ts +++ b/src/main/cluster-detectors/distribution-detector.ts @@ -60,6 +60,14 @@ export class DistributionDetector extends BaseClusterDetector { 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}; } @@ -122,4 +130,14 @@ export class DistributionDetector extends BaseClusterDetector { protected isK3s() { 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; + } + } }