Skip to content

feat(operator): let configSchema fields set the env var name - #951

Merged
ValgulNecron merged 3 commits into
masterfrom
fix/config-field-env-name
Nov 13, 2026
Merged

ValgulNecron merged 3 commits into
masterfrom
fix/config-field-env-name

Conversation

@ValgulNecron

@ValgulNecron ValgulNecron commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

A configSchema field 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 reads ENABLE_WHITELIST. white-list stayed false, so anyone could join a server that showed the whitelist as enforced.

This adds an optional envName to ConfigField:

  • The value stays under the field name in spec.config and 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 hit unknown config keys).
  • A renamed field adds a part to the config hash so the pod rolls. Templates without envName keep their current hash, so upgrading causes no restarts.
  • A schema where an envName makes two env fields export the same variable is refused. Duplicates without envName behave as before.
  • CRD: envName has the pattern ^[A-Za-z_][A-Za-z0-9_]*$ and a max length of 253. A CEL rule refuses envName on target: file fields, where it would have no effect. I ran make generate && make manifests.
  • gp-module validate mirrors the operator: it flags an invalid envName, an envName on a file field, and env var collisions. gp-module preview, web/src/types.ts and docs/module-authoring.md are updated to match. Changelog entry: changelog/unreleased/config-field-env-name.md.

Companion module PR: GameplanePanel/module#67 sets envName: ENABLE_WHITELIST on WHITELIST_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 without envName.
  • gp-module/internal/validator/validator_test.go: the three envName validator findings.

Verification

Locally I ran only compile checks: go build ./... (operator, gp-module), go vet and gofmt -l. CI is the verification authority.

🤖 Generated with Claude Code

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>
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between c5f4831 and 0390534.

Files selected for processing: 28

  • changelog/unreleased/config-field-env-name.md
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_backups.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_backupschedules.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_clusters.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_gameservers.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_gametemplates.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_modules.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_modulesources.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_networkcaptures.yaml
  • charts/gameplane/charts/gameplane-crds/crds/gameplane.local_restores.yaml
  • charts/gameplane/crd-manifests/gameplane.local_backups.yaml
  • charts/gameplane/crd-manifests/gameplane.local_backupschedules.yaml
  • charts/gameplane/crd-manifests/gameplane.local_clusters.yaml
  • charts/gameplane/crd-manifests/gameplane.local_gameservers.yaml
  • charts/gameplane/crd-manifests/gameplane.local_gametemplates.yaml
  • charts/gameplane/crd-manifests/gameplane.local_modules.yaml
  • charts/gameplane/crd-manifests/gameplane.local_modulesources.yaml
  • charts/gameplane/crd-manifests/gameplane.local_networkcaptures.yaml
  • charts/gameplane/crd-manifests/gameplane.local_restores.yaml
  • docs/module-authoring.md
  • gp-module/internal/preview/preview.go
  • gp-module/internal/validator/rules.go
  • gp-module/internal/validator/validator_test.go
  • operator/api/v1alpha1/gametemplate_types.go
  • operator/config/crd/gameplane.local_gametemplates.yaml
  • operator/internal/controller/gameserver_config.go
  • operator/internal/controller/gameserver_config_test.go
  • web/src/types.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

Share

@ValgulNecron ValgulNecron added type: fix Bug fix area: operator controller-runtime operator and CRDs area: modules game template OCI bundles labels Nov 12, 2026 — with Claude
@ValgulNecron ValgulNecron self-assigned this Nov 12, 2026
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown

CI Report - 0390534

run 43349757923 - attempt 1

0 failed - 29 passed - 4 skipped - 88m38s elapsed

Test selection: partial - per-suite table

Coverage

no coverage/* commit statuses found on 0390534

Changed

Area Files +/-
gp-module/ 3 +175/-2
operator/ 4 +160/-6
charts/ 18 +48/-22
docs/ 1 +15/-0
changelog/ 1 +7/-0
web/ 1 +2/-0

Slowest jobs

Job Duration
e2e telemetry / arm64 (kind) 23m51s
e2e telemetry / amd64 (kind) 23m0s
build e2e images 15m42s
e2e restricted-workloads / arm64 (kind) 15m37s
e2e restricted-workloads / amd64 (kind) 15m4s

e2e buckets run

api-agent, api-auth, api-mods, api-rbac, api-roles, backup-preparation, bot-fast, management-placement, monitoring, multicluster, network-isolation, operator, optional-components, postgres-availability, ratelimit, recovery, restricted-workloads, telemetry, upgrade, wake-hostport

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>
@ValgulNecron
ValgulNecron merged commit 4c96b1f into master Nov 13, 2026
75 checks passed
@ValgulNecron
ValgulNecron deleted the fix/config-field-env-name branch November 22, 2026 11:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: modules game template OCI bundles area: operator controller-runtime operator and CRDs type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants