feat: Sequentially update workloads one-by-one#116
Merged
jdheyburn merged 4 commits intoMar 20, 2026
Merged
Conversation
- ValkeyCluster controller now reconciles spec changes onto ValkeyNode CRs one at a time (replicas before primaries, descending node-index order), gating each step on the previous node's workload being fully rolled out - ValkeyNode controller stamps status.observedGeneration on every reconcile so ValkeyCluster can detect unprocessed spec changes; tracks rollout completion via isWorkloadRolledOut (StatefulSet revision equality / Deployment updatedReplicas gate) using APIReader to bypass cache - Fix upsertService and upsertConfigMap to use controllerutil.CreateOrUpdate, preventing update failures on second reconcile after operator restart - Extract conditionsChanged helper to deduplicate status comparison logic - Add integration tests for isWorkloadRolledOut, buildClusterValkeyNode propagation, condition ObservedGeneration tracking, and rolling-update sequencing in the ValkeyCluster controller - Add e2e tests: StatefulSet resourceVersion stability, ObservedGeneration tracking, rolling update readiness gate, workloadType immutability, and ValkeyCluster rolling update end-to-end Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
42149fb to
c044062
Compare
Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
jdheyburn
commented
Mar 18, 2026
Comment on lines
+424
to
+425
| // Iterate nodeIndex in reverse order (replicas before primary) | ||
| for nodeIndex := nodesPerShard - 1; nodeIndex >= 0; nodeIndex-- { |
Collaborator
Author
There was a problem hiding this comment.
A follow up PR will include logic to select a real replica, instead of via the nodeIndex
Collaborator
Author
There was a problem hiding this comment.
Added an issue for this:
bjosv
reviewed
Mar 20, 2026
Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
jdheyburn
added a commit
to jdheyburn/valkey-operator
that referenced
this pull request
Mar 30, 2026
This PR enhances the readiness probe checks such that nodes must be in a ready state before progressing with the sequential roll that was introduced in valkey-io#116. It does this by introducing checks for the node liveness via a Running status field. Once the node is live then the controller is enhanced to attempt to get the node to rejoin the cluster, regardless if a volume is set or not. Signed-off-by: Joseph Heyburn <jdheyburn@gmail.com>
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.
one at a time (replicas before primaries, descending node-index order),
gating each step on the previous node's workload being fully rolled out
so ValkeyCluster can detect unprocessed spec changes; tracks rollout
completion via isWorkloadRolledOut (StatefulSet revision equality /
Deployment updatedReplicas gate) using APIReader to bypass cache
preventing update failures on second reconcile after operator restart
propagation, condition ObservedGeneration tracking, and rolling-update
sequencing in the ValkeyCluster controller
tracking, rolling update readiness gate, workloadType immutability, and
ValkeyCluster rolling update end-to-end
Note: node-index is used to determine if it is a replica or not. A follow up PR will enhance this to use a live replica instead.
I think also the pods are being rolled too fast, so we might want to revisit the readiness checks, or introduce some additional cluster health checks when reconciling pods to ensure we're not adding fuel to the fire.
Update: I've got a follow up PR after this one that will stabilise this