refactor(api)!: move scheduling fields under spec.scheduling - #301
Conversation
Group affinity, nodeSelector, tolerations, topologySpreadConstraints, and priorityClassName into a new spec.scheduling block (SchedulingSpec) on ValkeyClusterSpec instead of leaving them at the top level. This is purely a relocation: the controller reads the same values through cluster.Spec.Scheduling (nil-guarded) and propagates them to each ValkeyNode unchanged. ValkeyNode itself keeps its own top-level fields. Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
…ctor/scheduling-relocation Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com> # Conflicts: # internal/controller/valkeycluster_controller.go
|
clean relocation, and the nil-guard on one thing worth calling out loudly on a breaking move like this: removing the top-level fields doesn't make old manifests error, the apiserver just prunes the now-unknown keys. so someone upgrading with top-level heads up that this is now DIRTY against main since #271 landed. on the rebase, the minor: |
|
| Filename | Overview |
|---|---|
| api/v1alpha1/valkeycluster_types.go | Adds the nested SchedulingSpec API shape for ValkeyCluster. |
| api/v1alpha1/zz_generated.deepcopy.go | Regenerates deepcopy handling for the nested scheduling spec. |
| config/crd/bases/valkey.io_valkeyclusters.yaml | Updates the CRD schema to expose scheduling fields under spec.scheduling. |
| internal/controller/valkeycluster_controller.go | Reads cluster scheduling values from Spec.Scheduling before creating ValkeyNode specs. |
| docs/valkeycluster.md | Documents the new spec.scheduling layout. |
Reviews (2): Last reviewed commit: "Add test assertion" | Re-trigger Greptile
Agree - we'll mark this as a breaking change in the release notes. I wonder if there is a way to make the API error on unknown fields.
I fixed it in the rebase, does it look okay now?
The idea is that ValkeyCluster and ValkeyCell build up the low-level |
Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
|
rebase looks right, i checked the literal:
for the apply path, yes, that already exists: server-side field validation ( the case i'd worry about isn't the apply path though, it's the clusters that are already stored. a ValkeyCluster created before the refactor has if you want a loud signal for those, the cheap version is to keep the old top-level fields in the schema for one release marked deprecated, have the operator prefer
that makes sense, the abstraction lives where the cluster-wide knowledge is. no objection. |
|
I'll be honest and say I don't know what the standard is for alpha CRDs (re deprecated fields). I'll bring it up on the weekly call later. |
|
@melancholictheory I am going to propose a breaking change note in the upgrade notes for this effort. |
|
@sandeepkunusoth Bjorn is OOO this week, would you be able to review please? |
|
sounds good. the one line that makes it land for already-created clusters: tell people to migrate their CRs before rolling the new CRD, since after the schema drops the fields the values are gone from the operator's view even though they're still in etcd. the apply-time case takes care of itself with strict field validation. |
This PR closes #300
Summary
Group affinity, nodeSelector, tolerations, topologySpreadConstraints, and priorityClassName into a new spec.scheduling block (SchedulingSpec) on ValkeyClusterSpec instead of leaving them at the top level. This is purely a relocation: the controller reads the same values through cluster.Spec.Scheduling (nil-guarded) and propagates them to each ValkeyNode unchanged. ValkeyNode itself keeps its own top-level fields.
Features / Behaviour Changes
No behaviour changes here, this is just an API change to set up for future PRs under #299.
Moves these fields from ValkeyCluster.spec:
to:
Checklist
Before submitting the PR make sure the following are checked:
pre-commit run --all-filesor hooks on commit)