mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
move kubeconfig route
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
9c9196e4de
commit
f0716e7a28
7 files changed
+66
-124
No files matched your search
@@ -1,39 +1,20 @@
|
||||
// Get cluster info
|
||||
|
||||
import config from "../config"
|
||||
import { kubeRequest } from "./kube-request";
|
||||
import { IClusterInfo, IClusterConfigMap } from "../common/cluster"
|
||||
import { IClusterInfo } from "../common/cluster"
|
||||
|
||||
export async function getClusterInfo(): Promise<IClusterInfo> {
|
||||
const [configMap, kubeVersion, pharosVersion] = await Promise.all([
|
||||
getClusterConfigMap().catch(() => ({} as IClusterConfigMap)),
|
||||
const [kubeVersion] = await Promise.all([
|
||||
getKubeVersion().catch(() => null),
|
||||
getPharosVersion().catch(() => null),
|
||||
]);
|
||||
return {
|
||||
...configMap,
|
||||
kubeVersion,
|
||||
pharosVersion,
|
||||
};
|
||||
}
|
||||
|
||||
export async function getClusterConfigMap() {
|
||||
const res = await kubeRequest<{ data: IClusterConfigMap }>({
|
||||
path: `/api/v1/namespaces/${config.LENS_NAMESPACE}/configmaps/config`,
|
||||
});
|
||||
return res.data;
|
||||
}
|
||||
|
||||
export async function getKubeVersion() {
|
||||
const res = await kubeRequest<{ gitVersion: string }>({
|
||||
path: "/version",
|
||||
});
|
||||
return res.gitVersion.slice(1);
|
||||
}
|
||||
|
||||
export async function getPharosVersion() {
|
||||
const res = await kubeRequest<{ data: { "pharos-version": string } }>({
|
||||
path: `/api/v1/namespaces/kube-system/configmaps/pharos-config`,
|
||||
});
|
||||
return res ? res.data["pharos-version"] : null;
|
||||
}
|
||||
Reference in new issue
Block a user