Skip to content

fix(main): restore missed options by cozystack use-case#326

Merged
Andrey Kolkov (androndo) merged 1 commit into
v1from
fix/missed-options
Jun 5, 2026
Merged

fix(main): restore missed options by cozystack use-case#326
Andrey Kolkov (androndo) merged 1 commit into
v1from
fix/missed-options

Conversation

@androndo

Copy link
Copy Markdown
Collaborator

No description provided.

@coderabbitai

coderabbitai Bot commented Jun 5, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6563697e-a3f5-4e75-a8f8-7afede9009bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/missed-options

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

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions github-actions Bot added api-change bugfix documentation Improvements or additions to documentation labels Jun 5, 2026

@lllamnyp Timofei Larkin (lllamnyp) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ./... and go vet ./api/... ./controllers/... clean.
  • make generate manifests produces 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 envtest TestSchema_OptionsValidation.

Correctness points checked:

  • Both member-creation sites carry Optionsbootstrap and scaleUp are the only non-test EtcdMemberSpec{} constructions, and both set Options: cluster.Status.Observed.Options. Replacement is delete-Pod-then-scaleUp, so there's no separate path that misses it.
  • Latching is completesnapshotSpecIntoObserved snapshots Spec.Options, and specEqualsObserved compares it; without the latter a mid-flight edit wouldn't re-snapshot (covered by TestSpecEqualsObserved_OptionsMatter).
  • No flag conflicts — the four flags are emitted only by optionFlags, which guards every field so unset emits nothing; nothing else in buildPod sets them.
  • Schema validation is sound — enum on the mode, Minimum=0/Minimum=1 on 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 autoCompactionMode and the retention format. mode: revision with 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 autoCompactionRetention comment says the pattern "admits what etcd itself parses"; etcd's parser also accepts ns/us/signed values, so the pattern is an intentional narrowing. Cosmetic — consider "the practical subset of what etcd parses."

LGTM.

@androndo Andrey Kolkov (androndo) merged commit fb7d3e4 into v1 Jun 5, 2026
1 of 2 checks passed
@androndo Andrey Kolkov (androndo) deleted the fix/missed-options branch June 5, 2026 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-change bugfix documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants