[FEATURE] Storage adjustments and minor tweaks (#9)

Co-authored-by: Dunemask <dunemask@gmail.com>
Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/9
This commit is contained in:
dunemask 2024-01-24 16:39:57 +00:00
parent 3d73f69678
commit 43c4409498
13 changed files with 121 additions and 39 deletions

View file

@ -7,6 +7,7 @@ CREATE TABLE servers (
server_type varchar(63) DEFAULT 'VANILLA',
cpu varchar(63) DEFAULT '500',
memory varchar(63) DEFAULT '512',
storage varchar(63) DEFAULT NULL,
backup_enabled BOOLEAN DEFAULT FALSE,
backup_host varchar(255) DEFAULT NULL,
backup_bucket_path varchar(255) DEFAULT NULL,

View file

@ -20,7 +20,9 @@ export async function createServerEntry(serverSpec) {
host,
version,
serverType: server_type,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage: storage_val,
extraPorts: extra_ports,
backupHost: backup_host,
backupBucket: backup_bucket_path,
@ -28,12 +30,15 @@ export async function createServerEntry(serverSpec) {
backupKey: backup_key,
backupInterval: backup_interval,
} = serverSpec;
var q = insertQuery(table, {
name,
host,
version,
server_type,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage: !storage_val || storage_val === "0" ? null : storage_val, // 0, undefined, null, or "0" becomes null
extra_ports,
backup_enabled: !!backup_interval ? true : null, // We already verified the payload, so any backup key will work
backup_host,
@ -51,7 +56,9 @@ export async function createServerEntry(serverSpec) {
host,
version,
server_type: serverType,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage,
extra_ports: extraPorts,
backup_enabled: backupEnabled,
backup_host: backupHost,
@ -68,7 +75,9 @@ export async function createServerEntry(serverSpec) {
host,
version,
serverType,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage,
extraPorts,
backupEnabled,
backupHost,
@ -102,7 +111,9 @@ export async function getServerEntry(serverId) {
host,
version,
server_type: serverType,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage,
extra_ports: extraPorts,
backup_enabled: backupEnabled,
backup_host: backupHost,
@ -119,7 +130,9 @@ export async function getServerEntry(serverId) {
host,
version,
serverType,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
storage,
extraPorts,
backupEnabled,
backupHost,
@ -140,7 +153,9 @@ export async function modifyServerEntry(serverSpec) {
host,
version,
serverType: server_type,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
// storage, // DO NOT INCLUDE THIS KEY, Not all storage providers in kubernetes allow for dynamically resizable PVCs
extraPorts: extra_ports,
backupEnabled: backup_enabled,
backupHost: backup_host,
@ -157,7 +172,9 @@ export async function modifyServerEntry(serverSpec) {
host,
version,
server_type,
cpu, // TODO: Ignored for now by the K8S manifests
memory,
// storage, // DO NOT INCLUDE THIS KEY, Not all storage providers in kubernetes allow for dynamically resizable PVCs
extra_ports,
backup_enabled,
backup_host,