Kubernetes support

* Total CPU and Memory usage for the entire cluster
* Total CPU and Memory usage for kubernetes pods
* Service discovery via annotations on ingress
* No storage stats yet
* No network stats yet
This commit is contained in:
James Wynn
2022-10-24 17:03:35 -05:00
parent b25ba09e18
commit c4333fd2dc
18 changed files with 479 additions and 19 deletions

View File

@@ -0,0 +1,27 @@
import path from "path";
import { readFileSync } from "fs";
import yaml from "js-yaml";
import { KubeConfig } from "@kubernetes/client-node";
import checkAndCopyConfig from "utils/config/config";
export default function getKubeConfig() {
checkAndCopyConfig("kubernetes.yaml");
const configFile = path.join(process.cwd(), "config", "kubernetes.yaml");
const configData = readFileSync(configFile, "utf8");
const config = yaml.load(configData);
const kc = new KubeConfig();
switch (config?.mode) {
case 'cluster':
kc.loadFromCluster();
break;
case 'default':
default:
kc.loadFromDefault();
}
return kc;
}