-
Notifications
You must be signed in to change notification settings - Fork 76
fix: store revisions to ensure grove upgrades do not cause new rollouts #710
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -118,6 +118,26 @@ Follow the instructions in the [quickstart guide](quickstart.md) to deploy a Pod | |
|
|
||
| ## Upgrade Notes | ||
|
|
||
| ### Rollout revision adoption | ||
|
|
||
| Before upgrading to a release that stores PodCliqueSet revisions in | ||
| `apps/v1` `ControllerRevision` objects: | ||
|
|
||
| 1. Apply the release CRDs before starting the new operator. The | ||
| `PodCliqueSet` CRD must preserve `status.currentRevision`. | ||
| 2. Allow every existing PodCliqueSet update to finish. A legacy object is | ||
| adopted only when `status.observedGeneration` equals `metadata.generation` | ||
| and no automatic update is active. | ||
| 3. Start the new operator. It records the already-observed desired workload as | ||
| a baseline ControllerRevision while preserving the existing rollout hashes; | ||
| it does not update or replace workload children during adoption. | ||
|
|
||
| The next rollout-relevant spec change creates a new ControllerRevision and | ||
| uses the normal update strategy. An active or otherwise unobserved legacy | ||
| revision is left unchanged and reports a reconciliation error until the | ||
| migration precondition is resolved. Downgrading afterward to an operator that | ||
| does not understand ControllerRevision-backed selection is unsupported. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Preventing the option to rollback is a big deal IMHO. Can you think of ways to support it, even if it comes with some price, including even pods being restarted? At least so we can discuss the tradeoffs. Being able to rollback is important, especially given the complexity of changes like this one and other major ones that are in the pipeline.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let me take a look. It should work theoretically as long as the actual template hash doesn't change, but I didn't test it. |
||
|
|
||
| ### ClusterTopology renamed to ClusterTopologyBinding | ||
|
|
||
| Grove does not provide automatic migration for existing `ClusterTopology` | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| // /* | ||
| // Copyright 2026 The Grove Authors. | ||
| // | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // */ | ||
|
|
||
| package utils | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
|
|
||
| grovecorev1alpha1 "github.com/ai-dynamo/grove/operator/api/core/v1alpha1" | ||
| commonrevision "github.com/ai-dynamo/grove/operator/internal/controller/common/revision" | ||
|
|
||
| appsv1 "k8s.io/api/apps/v1" | ||
| metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
| "sigs.k8s.io/controller-runtime/pkg/client" | ||
| ) | ||
|
|
||
| // GetSelectedPodCliqueSetRevision loads and validates the revision selected by the PodCliqueSet. | ||
| func GetSelectedPodCliqueSetRevision(ctx context.Context, cl client.Client, pcs *grovecorev1alpha1.PodCliqueSet) (*commonrevision.SelectedRevision, error) { | ||
| if pcs.Status.CurrentRevision == nil || *pcs.Status.CurrentRevision == "" { | ||
| return nil, fmt.Errorf("PodCliqueSet %v has no selected ControllerRevision", client.ObjectKeyFromObject(pcs)) | ||
| } | ||
| controllerRevision := &appsv1.ControllerRevision{} | ||
| if err := cl.Get(ctx, client.ObjectKey{Namespace: pcs.Namespace, Name: *pcs.Status.CurrentRevision}, controllerRevision); err != nil { | ||
| return nil, err | ||
| } | ||
| if !metav1.IsControlledBy(controllerRevision, pcs) { | ||
| return nil, fmt.Errorf("ControllerRevision %v is not controlled by PodCliqueSet %v", client.ObjectKeyFromObject(controllerRevision), client.ObjectKeyFromObject(pcs)) | ||
| } | ||
| selectedRevision, err := commonrevision.DecodeSelectedRevision(controllerRevision.Data.Raw) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("ControllerRevision %v has invalid revision data: %w", client.ObjectKeyFromObject(controllerRevision), err) | ||
| } | ||
| if pcs.Status.CurrentGenerationHash == nil || *pcs.Status.CurrentGenerationHash != selectedRevision.GenerationHash() { | ||
| return nil, fmt.Errorf("PodCliqueSet %v generation identity does not match ControllerRevision %v", client.ObjectKeyFromObject(pcs), client.ObjectKeyFromObject(controllerRevision)) | ||
| } | ||
| return selectedRevision, nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any kind of cleanup for old revisions or are they all kept for the whole PCS lifetime?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right now all but the active one are cleaned up: https://github.com/steved/grove/blob/7cb40f286add7cd4006e736a1f03dec202e0c6c5/operator/internal/controller/podcliqueset/revision.go#L300-L321