fix(main): restore missed options by cozystack use-case#326
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Timofei Larkin (lllamnyp)
left a comment
There was a problem hiding this comment.
Ports the legacy free-form spec.options map[string]string to a closed, typed EtcdOptions (quotaBackendBytes, autoCompactionMode, autoCompactionRetention, snapshotCount), latches it through status.observed, propagates it to members at both creation sites, and renders it onto the etcd command line. The design choice to type the set rather than carry a free-form flag map — with new flags landing as new typed fields instead of an escape hatch — is the right call: it keeps the surface something the operator can reason about.
Verification:
go build ./...andgo vet ./api/... ./controllers/...clean.make generate manifestsproduces no drift — the checked-in deepcopy and CRD YAML match the types.- Targeted tests pass:
TestBuildPod_AppliesEtcdOptions(incl. the nil-Options "emits nothing" case),TestSpecEqualsObserved_OptionsMatter,TestBootstrap_PropagatesOptionsToSeed,TestScaleUp_PropagatesOptionsToNewMember, and the envtestTestSchema_OptionsValidation.
Correctness points checked:
- Both member-creation sites carry Options —
bootstrapandscaleUpare the only non-testEtcdMemberSpec{}constructions, and both setOptions: cluster.Status.Observed.Options. Replacement is delete-Pod-then-scaleUp, so there's no separate path that misses it. - Latching is complete —
snapshotSpecIntoObservedsnapshotsSpec.Options, andspecEqualsObservedcompares it; without the latter a mid-flight edit wouldn't re-snapshot (covered byTestSpecEqualsObserved_OptionsMatter). - No flag conflicts — the four flags are emitted only by
optionFlags, which guards every field so unset emits nothing; nothing else inbuildPodsets them. - Schema validation is sound — enum on the mode,
Minimum=0/Minimum=1on the numerics (rejects--snapshot-count=0), and the retention pattern accepts a bare integer or a Go-duration shape.
Docs (concepts.md tuning-options section, migration.md map→typed section) match the implementation — field names, types, flag mappings, and the apply-on-create wording.
Non-blocking notes:
- No cross-field check between
autoCompactionModeand the retention format.mode: revisionwith a duration retention (e.g."5m") passes schema validation but etcd rejects it at startup (revision mode expects an integer). etcd fails closed, so this is a footgun rather than a hazard; a CEL rule pairing the two could reject it pre-admission if you want it caught earlier. Fine to defer. - The
autoCompactionRetentioncomment says the pattern "admits what etcd itself parses"; etcd's parser also acceptsns/us/signed values, so the pattern is an intentional narrowing. Cosmetic — consider "the practical subset of what etcd parses."
LGTM.
No description provided.