Repository navigation
Conversation
fwiesel
force-pushed
the
config/envconfig
branch
from
October 31, 2026 09:54
8c815ee to
9219fa2
Compare
Kubernetes uses the environment as the primary configuration interface. Module-owned options keep each environment name and default with its field. kelseyhightower/envconfig fills these structs at startup through separate module calls. Explicitly empty values do not restore defaults. Use the native integer map handler instead of a custom trait parser. Environment maps use comma-separated TRAIT:N entries and base-0 integer values. Keep validation of final positive limits and trait names with the eviction module. Keep the resolver's cap and minimum-one guard. Flag generation and descriptions belong to the later CLI commit. New settings remain fields with library-owned tags, not registry entries. Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
The deployment already supplies manager settings through environment variables. Remove the six duplicated --flag=$(ENV_VAR) arguments so the chart uses that configuration interface directly. Explain the native map format where operators configure trait limits. Environment values use comma-separated TRAIT:N entries. CLI overrides use repeated flags for individual keys. Document base-0 integers and the difference between empty environment and empty CLI values. Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Operators need to inspect and override settings from the command line. Register the aggregate options once with sflags. An anonymous shared member retains the existing unprefixed flags. Named controller members supply the certificate and eviction prefixes. Descriptions remain on the module-owned fields, beside their environment tags and defaults. Use native handlers for maps and slices so new fields need no registry or custom value methods. Trait maps use repeated TRAIT:N flags for per-key overrides of environment values. Unmentioned keys remain. Empty CLI map values are invalid. Environment maps use commas between TRAIT:N entries. Both handlers use base-0 integers. Scalar CLI values replace environment-derived defaults. Environment input must parse before CLI registration. Final domain validation stays with each module. This preserves CLI, environment, and built-in default precedence without a custom map parser or rendering method. Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
fwiesel
force-pushed
the
config/envconfig
branch
from
November 1, 2026 12:02
9219fa2 to
db42c61
Compare
Settings now live next to their owning controllers, so adding a setting touches one file per controller plus the chart. Signed-off-by: Fabian Wiesel <fabian.wiesel@sap.com>
Merging this branch will decrease overall coverage
Coverage detailsCompared to commit f5172c4 (run #41086905849)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files:
|
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.
Read operator configuration into module-owned options structs with
kelseyhightower/envconfig.
Each module owns its fields, environment tags, and defaults. The loader
processes each module separately with an empty prefix to retain exact
environment names. An explicitly empty environment value does not restore a
default. New settings require a tagged field and the chart's environment
value, not a central registry or custom value handler.
A separate commit generates optional CLI flags with
sflags. One
gflag.ParseTocall registersthe aggregate options. Anonymous shared options retain unprefixed flag names.
Named certificate and eviction members supply their existing prefixes.
The module fields own the
desctags. Environment-derived values become flagdefaults. Scalar precedence is CLI, then environment, then built-in default.
Native trait map format: migration required
Trait concurrency uses plain
map[string]intwith an exact compatibilityalias. No custom
Set(),String(), orType()methods remain.EVICTION_TRAIT_CONCURRENCY='A:1,B:2'.--eviction-trait-concurrency=A:4 --eviction-trait-concurrency=C:3.Each flag overrides one key. Unmentioned environment keys remain.
TRAIT=Ninput fails. A comma-separated CLI map is not supported.returns an error and does not clear the map.
0x10is 16 and010is 8.Module validation checks final positive limits and non-empty trait names
without surrounding whitespace. Valid final duplicates retain the last
value. Malformed environment input fails before CLI registration.
The resolver retains the default cap, lowest matching limit, and minimum
of one.
The separate chart commit removes six
--flag=$(ENV_VAR)arguments anddocuments the native environment and CLI encodings. Existing tests retain
their option wiring changes. No new repository tests are added.
Relates to #13.
Layout reduction round (2026-11-01)
Controller-owned options now live in their controller files:
internal/controller/eviction/controller.gointernal/controller/node_certificate_controller.gointernal/controller/hypervisor_controller.go(used by the manager and the Hypervisor controller only)The separate
internal/controller/eviction/options.go,internal/controller/options.go, andinternal/config/options.gofiles no longer exist.Churn vs PR base (added + deleted lines): 441 → 377.
Future settings: add the field (tag + default) to the owning options struct in its controller file — no central registration. Separate new semantic field groups with a blank line to keep reformatting churn low.