-
Notifications
You must be signed in to change notification settings - Fork 209
OCPBUGS-57646: Unify capitalization when comparing architectures for available updates #1255
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 |
|---|---|---|
|
|
@@ -49,15 +49,7 @@ func (optr *Operator) syncAvailableUpdates(ctx context.Context, config *configv1 | |
|
|
||
| channel := config.Spec.Channel | ||
| desiredArch := optr.getDesiredArchitecture(config.Spec.DesiredUpdate) | ||
| currentArch := runtime.GOARCH | ||
|
|
||
| if optr.release.Architecture == configv1.ClusterVersionArchitectureMulti { | ||
| currentArch = "multi" | ||
| } | ||
|
|
||
| if desiredArch == "" { | ||
| desiredArch = currentArch | ||
| } | ||
| currentArch := optr.getCurrentArchitecture() | ||
|
|
||
| // updates are only checked at most once per minimumUpdateCheckInterval or if the generation changes | ||
| optrAvailableUpdates := optr.getAvailableUpdates() | ||
|
|
@@ -330,7 +322,14 @@ func (optr *Operator) getDesiredArchitecture(update *configv1.Update) string { | |
| if update != nil { | ||
|
Member
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. Should this be if desiredArch == "" {
desiredArch = currentArch
} |
||
| return string(update.Architecture) | ||
| } | ||
| return "" | ||
| return optr.getCurrentArchitecture() | ||
| } | ||
|
|
||
| func (optr *Operator) getCurrentArchitecture() string { | ||
| if optr.release.Architecture == configv1.ClusterVersionArchitectureMulti { | ||
| return string(configv1.ClusterVersionArchitectureMulti) | ||
| } | ||
| return runtime.GOARCH | ||
| } | ||
|
|
||
| func calculateAvailableUpdatesStatus(ctx context.Context, clusterID string, transport *http.Transport, userAgent, updateService, desiredArch, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -111,22 +111,27 @@ func osusWithSingleConditionalEdge() (*httptest.Server, clusterconditions.Condit | |
| return osus, mockPromql, updates, from | ||
| } | ||
|
|
||
| func newOperator(url, version string, promqlMock clusterconditions.Condition) (*availableUpdates, *Operator) { | ||
| currentRelease := configv1.Release{Version: version, Image: "payload/" + version} | ||
| func newOperator(url, version string, promqlMock clusterconditions.Condition, arch string) (*availableUpdates, *Operator) { | ||
| var currentReleaseArch configv1.ClusterVersionArchitecture | ||
| if arch == string(configv1.ClusterVersionArchitectureMulti) { | ||
| currentReleaseArch = configv1.ClusterVersionArchitectureMulti | ||
| } | ||
| currentRelease := configv1.Release{Version: version, Image: "payload/" + version, Architecture: currentReleaseArch} | ||
|
|
||
| registry := clusterconditions.NewConditionRegistry() | ||
| registry.Register("Always", &always.Always{}) | ||
| registry.Register("PromQL", promqlMock) | ||
| operator := &Operator{ | ||
| updateService: url, | ||
| architecture: "amd64", | ||
| architecture: arch, | ||
| proxyLister: notFoundProxyLister{}, | ||
| cmConfigManagedLister: notFoundConfigMapLister{}, | ||
| conditionRegistry: registry, | ||
| queue: workqueue.NewTypedRateLimitingQueue[any](workqueue.DefaultTypedControllerRateLimiter[any]()), | ||
| release: currentRelease, | ||
| } | ||
| availableUpdates := &availableUpdates{ | ||
| Architecture: runtime.GOARCH, | ||
| Architecture: arch, | ||
| Current: configv1.Release{Version: version, Image: "payload/" + version}, | ||
| } | ||
| return availableUpdates, operator | ||
|
|
@@ -149,7 +154,7 @@ var availableUpdatesCmpOpts = []cmp.Option{ | |
| func TestSyncAvailableUpdates(t *testing.T) { | ||
| fakeOsus, mockPromql, expectedConditionalUpdates, version := osusWithSingleConditionalEdge() | ||
| defer fakeOsus.Close() | ||
| expectedAvailableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql) | ||
| expectedAvailableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql, runtime.GOARCH) | ||
| expectedAvailableUpdates.UpdateService = fakeOsus.URL | ||
| expectedAvailableUpdates.ConditionalUpdates = expectedConditionalUpdates | ||
| expectedAvailableUpdates.Channel = cvFixture.Spec.Channel | ||
|
|
@@ -231,7 +236,7 @@ func TestSyncAvailableUpdates_ConditionalUpdateRecommendedConditions(t *testing. | |
| t.Run(tc.name, func(t *testing.T) { | ||
| fakeOsus, mockPromql, conditionalUpdates, version := osusWithSingleConditionalEdge() | ||
| defer fakeOsus.Close() | ||
| availableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql) | ||
| availableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql, runtime.GOARCH) | ||
| optr.availableUpdates = availableUpdates | ||
| optr.availableUpdates.ConditionalUpdates = conditionalUpdates | ||
| expectedConditions := []metav1.Condition{{}} | ||
|
|
@@ -435,3 +440,58 @@ func TestEvaluateConditionalUpdate(t *testing.T) { | |
| }) | ||
| } | ||
| } | ||
|
|
||
| func TestSyncAvailableUpdatesMultiArchAfterMigration(t *testing.T) { | ||
| fakeOsus, mockPromql, expectedConditionalUpdates, version := osusWithSingleConditionalEdge() | ||
| defer fakeOsus.Close() | ||
|
|
||
| expectedAvailableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql, "Multi") | ||
|
|
||
| cv := cvFixture.DeepCopy() | ||
| cv.Spec.DesiredUpdate = &configv1.Update{ | ||
| Architecture: configv1.ClusterVersionArchitectureMulti, | ||
| Version: version, | ||
| Image: optr.release.Image, | ||
| Force: false, | ||
| } | ||
|
|
||
| expectedAvailableUpdates.UpdateService = fakeOsus.URL | ||
| expectedAvailableUpdates.ConditionalUpdates = expectedConditionalUpdates | ||
| expectedAvailableUpdates.Channel = cv.Spec.Channel | ||
| expectedAvailableUpdates.Condition = configv1.ClusterOperatorStatusCondition{ | ||
| Type: configv1.RetrievedUpdates, | ||
| Status: configv1.ConditionTrue, | ||
| } | ||
|
|
||
| err := optr.syncAvailableUpdates(context.Background(), cv) | ||
|
|
||
| if err != nil { | ||
| t.Fatalf("syncAvailableUpdates() unexpected error: %v", err) | ||
| } | ||
| if diff := cmp.Diff(expectedAvailableUpdates, optr.availableUpdates, availableUpdatesCmpOpts...); diff != "" { | ||
| t.Fatalf("available updates differ from expected:\n%s", diff) | ||
| } | ||
| } | ||
|
|
||
| func TestSyncAvailableUpdatesMultiArchAfterMigrationDesiredUpdateNil(t *testing.T) { | ||
|
Member
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. nit: looks like this could be collapsed with |
||
| fakeOsus, mockPromql, expectedConditionalUpdates, version := osusWithSingleConditionalEdge() | ||
| defer fakeOsus.Close() | ||
|
|
||
| expectedAvailableUpdates, optr := newOperator(fakeOsus.URL, version, mockPromql, "Multi") | ||
| expectedAvailableUpdates.UpdateService = fakeOsus.URL | ||
| expectedAvailableUpdates.ConditionalUpdates = expectedConditionalUpdates | ||
| expectedAvailableUpdates.Channel = cvFixture.Spec.Channel | ||
| expectedAvailableUpdates.Condition = configv1.ClusterOperatorStatusCondition{ | ||
| Type: configv1.RetrievedUpdates, | ||
| Status: configv1.ConditionTrue, | ||
| } | ||
|
|
||
| err := optr.syncAvailableUpdates(context.Background(), cvFixture) | ||
|
|
||
| if err != nil { | ||
| t.Fatalf("syncAvailableUpdates() unexpected error: %v", err) | ||
| } | ||
| if diff := cmp.Diff(expectedAvailableUpdates, optr.availableUpdates, availableUpdatesCmpOpts...); diff != "" { | ||
| t.Fatalf("available updates differ from expected:\n%s", diff) | ||
| } | ||
| } | ||
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.
We need this downcased form for Cincinnati, right? Here's
Multireturning nothing, whilemultireturns 4.20.0:Uh oh!
There was an error while loading. Please reload this page.
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.
Yes, however, the
currentArchvariable is only used for the following comparison:We use the
desiredArchfor the query parameter, "which is downcased" before creating the query parameters at:cluster-version-operator/pkg/cincinnati/cincinnati.go
Lines 90 to 93 in 667bc63
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.
Trying to check in multi-arch CI: 4.21 nightly multi CI -> 4.21.0-0.nightly-multi-2025-10-30-034235 -> but both e2e-ovn-serial-aws-multi-a-a-1of2 and e2e-ovn-serial-aws-multi-a-a-2of2 are failing to bootstrap.
Moving back to 4.20.0-0.nightly-multi: 4.20.0-0.nightly-multi-2025-10-30-035942 -> e2e-ovn-serial-aws-multi-a-a-1of2 -> Artifacts -> ... -> e2e artifacts:
which means this test logic is happy about the CVO showing the recommended update to the
sha256:cccc...release. Checking gather-extra pod logs:well, I can see
arch=multiin there, and it's not talking aboutVersionNotFoundwhen pulling from the e2e test's172.30.166.91. Would be nice if it logged this single->multi transition branch. Ah here iscincinnati.godoing theMulti->multidowncasing, so that's one bit I'd missed earlier.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.
ah, the multi CI is passing because those tests aren't setting
spec.desired.architecture: Multi. We should grow some CI that exercises that.