Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/cvo/cvo_scenarios_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2022,7 +2022,7 @@ func TestCVO_UpgradePreconditionFailing(t *testing.T) {
t.Fatal(err)
}
actions = client.Actions()
if len(actions) != 1 {
if len(actions) != 2 {
t.Fatalf("%s", spew.Sdump(actions))
}
expectGet(t, actions[0], "clusterversions", "", "version")
Expand Down Expand Up @@ -2170,7 +2170,7 @@ func TestCVO_UpgradePreconditionFailing(t *testing.T) {
expectUpdateStatus(t, actions[1], "clusterversions", "", &configv1.ClusterVersion{
ObjectMeta: metav1.ObjectMeta{
Name: "version",
ResourceVersion: "3",
ResourceVersion: "4",
Generation: 1,
},
Spec: configv1.ClusterVersionSpec{
Expand Down
18 changes: 13 additions & 5 deletions pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,11 +439,8 @@ func (w *SyncWorker) Update(ctx context.Context, generation int64, desired confi
oldDesired = &w.work.Desired
}

w.work = work

if !versionEqual && oldDesired == nil {
klog.Infof("Propagating initial target version %v to sync worker loop in state %s.", desired, state)
} else if !versionEqual && state == payload.InitializingPayload {
// since oldDesired is not nil this is not the first time update is invoked and therefore w.work is not nil
if !versionEqual && oldDesired != nil && state == payload.InitializingPayload {
klog.Warningf("Ignoring detected version change from %v to %v during payload initialization", *oldDesired, work.Desired)
w.work.Desired = *oldDesired
if overridesEqual && capabilitiesEqual {
Expand All @@ -455,9 +452,20 @@ func (w *SyncWorker) Update(ctx context.Context, generation int64, desired confi
implicit, err := w.loadUpdatedPayload(ctx, work, cvoOptrName)
w.lock.Lock()
if err != nil {
// save latest capability settings if not first time through
if w.work != nil {
w.work.Capabilities = work.Capabilities
}
return w.status.DeepCopy()
}

if !versionEqual && oldDesired == nil {
klog.Infof("Propagating initial target version %v to sync worker loop in state %s.", desired, state)
}

// update work to include desired version now that it has been successfully loaded
w.work = work

// Update capabilities settings and status to include any capabilities that were implicitly enabled due
// to previously managed resources.
w.work.Capabilities = capability.SetFromImplicitlyEnabledCapabilities(implicit, w.work.Capabilities)
Expand Down