Skip to content

spike-common-config#262

Draft
stefan-ctrl wants to merge 17 commits intomainfrom
spike-common-config
Draft

spike-common-config#262
stefan-ctrl wants to merge 17 commits intomainfrom
spike-common-config

Conversation

@stefan-ctrl
Copy link
Member

@stefan-ctrl stefan-ctrl commented Mar 5, 2026

Important

This feature is currently postponed and will be picked up at a later date.

MR Summary: Migrate admin and notification to file-based config

Goal

Migrate the admin and notification controller configs from environment-variable-based configuration (envFrom + .cfg files) to the new YAML config-file-based configuration. The controllers now read config from /etc/controlplane/config/config.yaml, mounted as a ConfigMap (admin) or Secret (notification).

Key technical finding

  1. defaultConfig() pre-populates the struct with all defaults from defaults.go
  2. v.UnmarshalExact() uses mapstructure v2 which only overwrites fields present in the YAML -- absent fields are skipped and retain their defaults
  3. UnmarshalExact additionally rejects unknown keys (catches typos)

Why kustomize merge/patches don't work for this

The data["config.yaml"] field is an opaque string from kustomize's perspective. behavior: merge only merges at the data-key level, therefore merge replaces the entire value. This is why the Go-side default merging is the correct solution.

Open problems

secret-manager and file-manager use common-server, not common

The current solution is built around the common package's config (common/pkg/config) and therefore for the config required fro reconcilers and operators. However, secret-manager and file-manager use common-server as their base library but would prefer the optimized output.

Central/shared config values across controllers

There is currently no solution for configuration values that are shared across all controllers (e.g. tracing URLs, common infrastructure endpoints). Each controller's config file is independent -- there is no mechanism to define a value once and have it applied to all controllers.

This is an architectural question that was not addressed in this spike.

What was NOT completed / other gaps

  • Other controllers (rover, gateway, rover-server, etc.) still use the old env-var .cfg approach and have not been migrated

@stefan-ctrl stefan-ctrl self-assigned this Mar 5, 2026
@stefan-ctrl stefan-ctrl added common Anything related to the common library go Pull requests that update go code enhancement New feature or request labels Mar 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

common Anything related to the common library enhancement New feature or request go Pull requests that update go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant