Repository navigation
feat: auto-size game memory settings from the container memory limit - #68
Merged
Merged
Conversation
A ConfigField may declare autoFromMemoryLimit: {percent}; when neither
spec.config nor the schema default provides a value, materializeConfig
computes percent% of the game container's effective memory limit,
rendered as whole mebibytes (8Gi at 75% -> 6144M). The computed value
flows through env, configFiles values, and the config hash, so resizing
a server rolls the pod with a matching heap. Explicit values and schema
defaults still win; no memory limit leaves the field unset.
Also extracts the effectiveResources helper the game and agent
container builders were both hand-rolling.
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
Mirrors autoFromMemoryLimit into the template types and shows an "Auto: N% of the memory limit" placeholder on empty auto-sized fields so users know leaving them blank is the right move. Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
Points the submodule at gameplane-module#8: MAX_MEMORY/INIT_MEMORY now
declare autoFromMemoryLimit: {percent: 75} instead of static 2G/1G
defaults, with gameplaneMinVersion 0.2.0-beta.6 gating older operators.
Signed-off-by: valgulnecron <39313199+ValgulNecron@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Game servers now use the RAM they're given. A
configSchemafield may declareautoFromMemoryLimit: {percent}; when the user leaves the field empty, the operator computes percent% of the game container's effective memory limit (GameServer override or template default) and injects it as the field's value — rendered as whole mebibytes (8Gi × 75% →6144M). Resizing a server recomputes the value and rolls the pod (it participates in the config hash).Precedence is unchanged: explicit
spec.configvalue > schemadefault> auto-computed > unset.ConfigField.autoFromMemoryLimit(+ regenerated deepcopy/CRD YAML/chart CRDs). Plain Min/Max markers only — no CEL in the unbounded configSchema array (apiserver cost budget).materializeConfigcomputes the value; new sharedeffectiveResourceshelper replaces the two hand-rolled copies in the game/agent container builders.MAX_MEMORY/INIT_MEMORYdrop their static2G/1Gdefaults for 75% auto-sizing;gameplaneMinVersion: 0.2.0-beta.6keeps older operators from pruning the field into itzg's 1G fallback.Why
The old static
2Gheap default was disconnected from the memory slider: an 8Gi server wasted 6Gi, and a hand-set heap at/above the limit got OOM-killed (the cgroup limit caps memory but never sizes the heap).Tests
materializeConfigunit cases: computed value, explicit override wins, schema default wins, template-resources fallback, no-limit stays unset, hash tracks the limit.MAX_MEMORY=6144Mfrom an 8Gi limit; explicitINIT_MEMORYsurvives.Note: helm upgrade never updates CRDs — existing clusters need
kubectl applyof the regenerated CRD YAML (kind CI clusters are recreated per job).🤖 Generated with Claude Code