mirror of
https://github.com/gethomepage/homepage.git
synced 2025-12-07 09:35:54 -08:00
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:
27
src/utils/config/kubernetes.js
Normal file
27
src/utils/config/kubernetes.js
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user