[FEATURE] Initial Storage Configuration
This commit is contained in:
parent
3d73f69678
commit
b84fba6153
4 changed files with 46 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
extraPorts: extra_ports,
|
||||
backupHost: backup_host,
|
||||
backupBucket: backup_bucket_path,
|
||||
|
@ -33,7 +35,9 @@ export async function createServerEntry(serverSpec) {
|
|||
host,
|
||||
version,
|
||||
server_type,
|
||||
cpu, // TODO: Ignored for now by the K8S manifests
|
||||
memory,
|
||||
storage,
|
||||
extra_ports,
|
||||
backup_enabled: !!backup_interval ? true : null, // We already verified the payload, so any backup key will work
|
||||
backup_host,
|
||||
|
@ -51,7 +55,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 +74,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 +110,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 +129,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 +152,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 +171,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,
|
||||
|
|
26
src/components/server-options/StorageOption.jsx
Normal file
26
src/components/server-options/StorageOption.jsx
Normal file
|
@ -0,0 +1,26 @@
|
|||
import TextField from "@mui/material/TextField";
|
||||
import MenuItem from "@mui/material/MenuItem";
|
||||
|
||||
const maxStorageSupported = 80;
|
||||
export const storageOptions = new Array(2 * maxStorageSupported)
|
||||
.fill(0)
|
||||
.map((v, i) => (i + 1) * 0.5);
|
||||
|
||||
export default function StorageOption(props) {
|
||||
const { value, onChange } = props;
|
||||
return (
|
||||
<TextField
|
||||
label="Storage"
|
||||
onChange={onChange}
|
||||
value={value ?? null}
|
||||
select
|
||||
required
|
||||
SelectProps={{ MenuProps: { sx: { maxHeight: "20rem" } } }}
|
||||
>
|
||||
<MenuItem value={0}>No Storage</MenuItem>
|
||||
{storageOptions.map((o, i) => (
|
||||
<MenuItem value={o} key={i}>{`${o} GB`}</MenuItem>
|
||||
))}
|
||||
</TextField>
|
||||
);
|
||||
}
|
|
@ -22,6 +22,7 @@ import MemoryOption, {
|
|||
memoryOptions,
|
||||
} from "@mcl/components/server-options/MemoryOption.jsx";
|
||||
import ExtraPortsOption from "@mcl/components/server-options/ExtraPortsOption.jsx";
|
||||
import StorageOption from "@mcl/components/server-options/StorageOption.jsx";
|
||||
|
||||
import BackupHostOption from "@mcl/components/server-options/BackupHostOption.jsx";
|
||||
import BackupBucketOption from "@mcl/components/server-options/BackupBucketOption.jsx";
|
||||
|
@ -36,6 +37,7 @@ const defaultServer = {
|
|||
serverType: serverTypeOptions[0],
|
||||
cpu: cpuOptions[0],
|
||||
memory: memoryOptions[2], // 1.5GB
|
||||
storage: 0,
|
||||
extraPorts: [],
|
||||
};
|
||||
|
||||
|
@ -99,6 +101,7 @@ export default function CreateCoreOptions() {
|
|||
/>
|
||||
<CpuOption value={spec.cpu} onChange={coreUpdate("cpu")} />
|
||||
<MemoryOption value={spec.memory} onChange={coreUpdate("memory")} />
|
||||
<StorageOption value={spec.storage} onChange={coreUpdate("storage")} />
|
||||
<ExtraPortsOption onChange={updateSpec} />
|
||||
<FormControlLabel
|
||||
control={
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue