Skip to content

feat!: Replace the two spec booleans with enums - #75

Merged
as51340 merged 1 commit into
mainfrom
feat/enum-instead-of-bool
Oct 14, 2026
Merged

as51340 merged 1 commit into
mainfrom
feat/enum-instead-of-bool

Conversation

@as51340

@as51340 as51340 commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

Why

The API conventions say to "think twice about bool fields": many start as on/off and later need a third, mutually exclusive option. Our only two booleans both answer questions like that:

  • fileLogging answers "where do the log files go". It has already lost one answer (the separate log claim, removed 2026-10-07) and could gain another (an emptyDir).
  • configureCorePattern answers "who sets the node's core_pattern". A plausible third answer is a per-node DaemonSet instead of a privileged init container in every pod.

On v1alpha1 this is cheap to change now.

What

Before After
storage.<role>.fileLogging: true (default) / false storage.<role>.logFile: LibClaim (default) / None
coreDumps.configureCorePattern: true (default) / false coreDumps.corePattern: Operator (default) / Node
  • Types: LogFileLocation and CorePatternOwner, plain string enums with schema defaults, like retentionPolicy. The DefaultLogFile/DefaultCorePattern constants replace the bool defaults.
  • Builders: they derive the same internal switches from the enums, treating anything but None/Node as the default. A spec that never passed admission therefore behaves like an admitted one, and the generated pods are identical.
  • Docs and manifests: the sample, README, docs/{flags,backup-restore,rolling-restart-pacing}.md, the e2e manifests and CLAUDE.md now use the new names. CLAUDE.md now says the spec has no bools, as a convention.
  • Chart: version 1.0.1-rc.2 → 1.0.1-rc.3 for the CRD change.

Testing

  • Envtest: the defaults spec expects logFile: LibClaim and corePattern: Operator, the claim-pin and core dumps update specs use the enums, and new cases reject unknown values (EmptyDir, DaemonSet).
  • Builder unit tests use LogFileNone/CorePatternNode.
  • make test, make lint, make chart-verify, make helm-lint, make chart-version-check, and go vet -tags e2e ./test/.... The e2e suite itself didn't run here; its manifests only change field names.

storage.<role>.fileLogging and coreDumps.configureCorePattern were the only
booleans in the spec, and both answer a question with more than two answers.
Where the log files go already lost one, the separate log claim, and could
grow another (an emptyDir). Who sets the node's core_pattern could be a
per-node DaemonSet instead of a privileged init container in every pod.

- storage.<role>.fileLogging (bool, default true) becomes
  storage.<role>.logFile: LibClaim | None, default LibClaim.
- coreDumps.configureCorePattern (bool, default true) becomes
  coreDumps.corePattern: Operator | Node, default Operator.

The pods are unchanged: the builders derive the same switches from the
enums, treating anything but None and Node as the default so a spec that
never passed admission behaves like an admitted one. Admission rejects a
value it does not know.

BREAKING CHANGE: the old fields are gone from the schema, so the API server
prunes them, and a cluster that set either to false reads the new default
once the CRD is upgraded: its pods roll onto file logging, or gain the
privileged core pattern init container, which a restricted namespace
rejects. Stop the operator, upgrade the CRD, set logFile: None or
corePattern: Node on those clusters, then start the new operator.
@as51340 as51340 self-assigned this Oct 14, 2026
@as51340
as51340 merged commit 4718d6e into main Oct 14, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant