[FEATURE] Integrated Minecluster with Cairo & Established Gitea workflows (#12)

Co-authored-by: Dunemask <dunemask@gmail.com>
Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/12
This commit is contained in:
dunemask 2024-02-05 02:13:32 +00:00
parent edbfc2348a
commit 78c5b72482
30 changed files with 391 additions and 53 deletions

View file

@ -1,8 +1,7 @@
import k8s from "@kubernetes/client-node";
import { getDeployments } from "./k8s-server-control.js";
import { getUserDeployments } from "./k8s-server-control.js";
import { getServerEntries } from "../database/queries/server-queries.js";
const kc = new k8s.KubeConfig();
kc.loadFromDefault();
import kc from "./k8s-config.js";
const k8sMetrics = new k8s.Metrics(kc);
const namespace = process.env.MCL_SERVER_NAMESPACE;
@ -42,9 +41,9 @@ function getServerStatus(server) {
return { serverAvailable, ftpAvailable, services, deploymentAvailable };
}
export async function getInstances() {
export async function getInstances(cairoId) {
const [serverDeployments, podMetricsRes, entries] = await Promise.all([
getDeployments(),
getUserDeployments(cairoId),
k8sMetrics.getPodMetrics(namespace),
getServerEntries(),
]);