Skip to content

Commit

Permalink
feature(kubernetes) ProxyFleet Class & Constructor working
Browse files Browse the repository at this point in the history
  • Loading branch information
mrallan140 committed Dec 5, 2023
1 parent 93d91d0 commit 263c324
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
7 changes: 5 additions & 2 deletions app/server/api/kubernetes/deploy_proxyfleet/[name].get.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ const k8sCRDApi = kc.makeApiClient(k8s.CustomObjectsApi);
export default defineEventHandler(async (event) => {
const name = getRouterParam(event, "name") || "Qraft-Proxyfleet";
const metadata = new shulker.ShulkerMetadata(name);
const Deploy_ProxyFleet = new shulker.ProxyFleet(metadata);
//console.log(JSON.stringify(Deploy_ProxyFleet, null, 4));
const spec: shulker.ProxyFleetSpec = new shulker.ProxyFleetSpec(
new shulker.ProxyFleetSpecClusterRef("getting-started"),
);
const Deploy_ProxyFleet = new shulker.ProxyFleet(metadata, spec);
console.log(JSON.stringify(Deploy_ProxyFleet, null, 4));
const Deployments_Result = await k8sCRDApi.createNamespacedCustomObject(
"shulkermc.io",
"v1alpha1",
Expand Down
24 changes: 20 additions & 4 deletions app/server/utils/Shulker_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,32 @@ class ShulkerMetadata {
public namespace: string = config.deployment_namespace,
) {}
}
class ProxyFleetSpecTemplateSpec {
constructor(
public version: object = { channel: "Velocity", name: "latest" },
public config: object = {},
) {}
}
class ProxyFleetSpecTemplate {
constructor(
public spec: ProxyFleetSpecTemplateSpec = new ProxyFleetSpecTemplateSpec(),
) {}
}
class ProxyFleetSpecService {
constructor(
public type: string = "LoadBalancer",
public externalTraffiCPolicy: string = "Local",
public externalTrafficPolicy: string = "Local",
) {}
}
class ProxyFleetSpecClusterRef {
constructor(public name: string) {}
}
class ProxyFleetSpec {
constructor(
public replicas: number | null,
public clusterRef: { name: string },
public clusterRef: ProxyFleetSpecClusterRef,
public replicas: number = 1,
public services: ProxyFleetSpecService = new ProxyFleetSpecService(),
public template: ProxyFleetSpecTemplate = new ProxyFleetSpecTemplate(),
) {
// Initialize other properties if needed
}
Expand All @@ -32,9 +47,9 @@ class ProxyFleetStatus {
class ProxyFleet {
constructor(
public metadata: ShulkerMetadata,
public spec: ProxyFleetSpec,
public apiVersion: string = "shulkermc.io/v1alpha1",
public kind: string = "ProxyFleet",
public spec?: ProxyFleetSpec,
public status?: ProxyFleetStatus,
) {}
}
Expand Down Expand Up @@ -108,6 +123,7 @@ export {
ShulkerMetadata,
ProxyFleet,
ProxyFleetSpec,
ProxyFleetSpecClusterRef,
ProxyFleetStatus,
MinecraftServer,
MinecraftServerSpec,
Expand Down

0 comments on commit 263c324

Please sign in to comment.