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 @@ -1886,7 +1886,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 @@ -2016,7 +2016,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
14 changes: 9 additions & 5 deletions pkg/cvo/sync_worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,11 +406,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 {
Expand All @@ -425,6 +422,13 @@ func (w *SyncWorker) Update(ctx context.Context, generation int64, desired confi
return w.status.DeepCopy()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is leaving out #770's Overrides copy, but that's a separate bug series, so I'm ok with that.

}

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

// notify the sync loop that we changed config
if w.cancelFn != nil {
klog.V(2).Info("Cancel the sync worker's current loop")
Expand Down