Repository navigation
feat(operator): let configSchema fields set the env var name - #951
Conversation
A configSchema field was always exported as an env var named after the field. The minecraft-java "Enforce whitelist" field (WHITELIST_ENABLED) therefore never reached the itzg image, which only reads ENABLE_WHITELIST, and the whitelist stayed off. Add an optional envName to ConfigField. The value stays under the field name in spec.config and the config Secret; only the container env var name changes, so modules can fix a wrong mapping without orphaning saved values. Renamed fields add a part to the config hash so the pod rolls, while templates without envName keep their hash. A schema where an envName makes two env fields export the same variable is refused. The gp-module preview, web types and module authoring docs follow. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 56 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
CI Report - 0390534run 43349757923 - attempt 1 0 failed - 29 passed - 4 skipped - 88m38s elapsed Test selection: partial - per-suite table Coverageno coverage/* commit statuses found on 0390534 Changed
Slowest jobs
e2e buckets run
|
Resolve the generated CRD conflicts by taking master's copies and re-running make generate && make manifests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
…ster Review follow-up. The CRD now refuses envName on a target file field, where it had no effect. gp-module validate mirrors the operator's checks: an envName must be a valid env var name, must not sit on a file field, and must not make two env fields export the same variable, so a module fails validation instead of failing at reconcile time. New tests cover the validator findings and pin the config hash of a schema without envName, which must not change on upgrade. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Claude <noreply@anthropic.com>
Summary
A
configSchemafield always became an env var named after the field. On minecraft-java, "Enforce whitelist" (WHITELIST_ENABLED) therefore never reached the itzg image, because the image only readsENABLE_WHITELIST.white-liststayedfalse, so anyone could join a server that showed the whitelist as enforced.This adds an optional
envNametoConfigField:nameinspec.configand in the config Secret. Only the container env var name changes, so a module can fix a wrong mapping without orphaning saved values (a rename would hitunknown config keys).envNamekeep their current hash, so upgrading causes no restarts.envNamemakes two env fields export the same variable is refused. Duplicates withoutenvNamebehave as before.envNamehas the pattern^[A-Za-z_][A-Za-z0-9_]*$and a max length of 253. A CEL rule refusesenvNameontarget: filefields, where it would have no effect. I ranmake generate && make manifests.gp-module validatemirrors the operator: it flags an invalidenvName, anenvNameon a file field, and env var collisions.gp-module preview,web/src/types.tsanddocs/module-authoring.mdare updated to match. Changelog entry:changelog/unreleased/config-field-env-name.md.Companion module PR: GameplanePanel/module#67 sets
envName: ENABLE_WHITELISTonWHITELIST_ENABLED. Older operators prune the unknown field and behave as before.Tests
New tests only; no existing test was changed.
operator/internal/controller/gameserver_config_test.go: the rename, a password field keeping its Secret key, the hash change, the collision error, and an unchanged hash for a schema withoutenvName.gp-module/internal/validator/validator_test.go: the threeenvNamevalidator findings.Verification
Locally I ran only compile checks:
go build ./...(operator, gp-module),go vetandgofmt -l. CI is the verification authority.🤖 Generated with Claude Code