Skip to content

New config-file first configuration approach#129

Merged
mclasmeier merged 39 commits into
mainfrom
backup/mc/new-config-2
May 13, 2026
Merged

New config-file first configuration approach#129
mclasmeier merged 39 commits into
mainfrom
backup/mc/new-config-2

Conversation

@mclasmeier
Copy link
Copy Markdown
Collaborator

@mclasmeier mclasmeier commented May 4, 2026

Summary

  • Introduces deployer.Config (internal/deployer/config.go) — a single, self-contained, YAML-serializable configuration struct that replaces ~20 loose variables, setter methods, and override maps scattered across the deployer and CLI layers.
  • Replaces ad-hoc --override / --set machinery with a config-file-first model: --config/-c loads a full YAML config, --set writes directly into the Config struct via dotted paths, and all CLI flags are now configShortCut wrappers that mutate the same struct.
  • Extracts first-class types into internal/types/ClusterType, Exposure, and ResourceProfile are now typed enums with YAML marshal/unmarshal, replacing free-form strings.
  • Simplifies clusterdefaults — collapses the Manager/Detector/Applicator abstraction (flagged as over-engineered via TODO(ROX-34499)) into a single ApplyClusterDefaults function that merges a defaults map into Config.
  • Adds --dry-run flag and moves config resolution (version lookup, operator config, spec composition) into runDeploy before the deployer is invoked.
  • Slims down Deployer — removes ~15 fields and ~10 setter methods (SetMainImageTag, SetFeatureFlags, SetUseOLM, SetPortForwardingEnabled, etc.). The deployer now receives configuration via SetConfig() and reads everything from d.config.*.

This PR takes care of

and addresses a couple of other TODOs in the code.

@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from 3cdb493 to 607ea2e Compare May 4, 2026 12:07
@mclasmeier mclasmeier requested review from AlexVulaj and removed request for AlexVulaj May 4, 2026 12:08
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch 2 times, most recently from e209b63 to 402bc30 Compare May 4, 2026 12:36
@mclasmeier mclasmeier changed the title wip New configuration mechanism May 4, 2026
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch 3 times, most recently from 89c3a05 to 805a7d1 Compare May 4, 2026 12:54
@mclasmeier mclasmeier requested a review from AlexVulaj May 4, 2026 13:12
@mclasmeier mclasmeier marked this pull request as ready for review May 4, 2026 15:53
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from 60f24ee to 83cbaf9 Compare May 4, 2026 15:53
@mclasmeier mclasmeier changed the title New configuration mechanism New config-file first configuration approach May 4, 2026
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from 83cbaf9 to c9eb6ac Compare May 5, 2026 06:14
@mclasmeier mclasmeier requested review from porridge and vladbologa May 5, 2026 06:14
@mclasmeier mclasmeier added the ci-rollout Marks a PR to be a prerequisite for rolling out roxie in stackrox CI. label May 5, 2026
Comment thread internal/clusterdefaults/clusterdefaults.go Outdated
Comment thread internal/types/cluster_type.go
Comment thread cmd/deploy.go
@mclasmeier mclasmeier requested a review from AlexVulaj May 5, 2026 20:50
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from bd378eb to dd047d3 Compare May 5, 2026 21:19
Comment thread internal/deployer/config.go Outdated
Comment thread internal/deployer/config.go
Comment thread internal/deployer/config.go
Comment thread internal/deployer/config.go Outdated
Comment thread internal/deployer/deploy_via_operator.go
Comment thread internal/clusterdefaults/clusterdefaults.go Outdated
Comment thread cmd/deploy.go Outdated
Comment thread cmd/deploy.go Outdated
Comment thread cmd/deploy.go
Comment thread cmd/deploy.go
Co-authored-by: Marcin Owsiany <porridge@redhat.com>
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from 13260a2 to d6fc8db Compare May 7, 2026 12:22
@mclasmeier
Copy link
Copy Markdown
Collaborator Author

@porridge @AlexVulaj merged in current main.

@mclasmeier
Copy link
Copy Markdown
Collaborator Author

@porridge I believe I have now addressed all of your comments except the one about helper functions for the pflag setup.

Comment thread cmd/deploy.go Outdated
Comment thread cmd/deploy.go Outdated
Moritz Clasmeier added 2 commits May 11, 2026 14:01
Also:
* Switch to using mergo (& removing dead code after the switch).
* Add tests for CLI flag parsing.
@mclasmeier mclasmeier force-pushed the backup/mc/new-config-2 branch from 7037a64 to 5bcd644 Compare May 11, 2026 12:02
@mclasmeier
Copy link
Copy Markdown
Collaborator Author

@porridge, @AlexVulaj I have reworked the flag parsing setup, reducing duplication and complexity.

@mclasmeier mclasmeier requested review from AlexVulaj and porridge May 11, 2026 12:06
@mclasmeier
Copy link
Copy Markdown
Collaborator Author

(Manually) merged in main branch to fix conflicts.

Comment thread internal/deployer/config.go
@mclasmeier mclasmeier merged commit d05a8d7 into main May 13, 2026
11 checks passed
@AlexVulaj AlexVulaj deleted the backup/mc/new-config-2 branch May 13, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-rollout Marks a PR to be a prerequisite for rolling out roxie in stackrox CI.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants