Skip to content

Commit 60cff2f

Browse files
Merge pull request #1255 from DavidHurta/ocpbugs-57646
OCPBUGS-57646: Unify capitalization when comparing architectures for available updates
2 parents df1ec55 + 86e81cf commit 60cff2f

2 files changed

Lines changed: 393 additions & 71 deletions

File tree

pkg/cvo/availableupdates.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,15 +49,7 @@ func (optr *Operator) syncAvailableUpdates(ctx context.Context, config *configv1
4949

5050
channel := config.Spec.Channel
5151
desiredArch := optr.getDesiredArchitecture(config.Spec.DesiredUpdate)
52-
currentArch := runtime.GOARCH
53-
54-
if optr.release.Architecture == configv1.ClusterVersionArchitectureMulti {
55-
currentArch = "multi"
56-
}
57-
58-
if desiredArch == "" {
59-
desiredArch = currentArch
60-
}
52+
currentArch := optr.getCurrentArchitecture()
6153

6254
// updates are only checked at most once per minimumUpdateCheckInterval or if the generation changes
6355
optrAvailableUpdates := optr.getAvailableUpdates()
@@ -327,10 +319,17 @@ func (optr *Operator) getAvailableUpdates() *availableUpdates {
327319
}
328320

329321
func (optr *Operator) getDesiredArchitecture(update *configv1.Update) string {
330-
if update != nil {
322+
if update != nil && len(update.Architecture) > 0 {
331323
return string(update.Architecture)
332324
}
333-
return ""
325+
return optr.getCurrentArchitecture()
326+
}
327+
328+
func (optr *Operator) getCurrentArchitecture() string {
329+
if optr.release.Architecture == configv1.ClusterVersionArchitectureMulti {
330+
return string(configv1.ClusterVersionArchitectureMulti)
331+
}
332+
return runtime.GOARCH
334333
}
335334

336335
func calculateAvailableUpdatesStatus(ctx context.Context, clusterID string, transport *http.Transport, userAgent, updateService, desiredArch,

0 commit comments

Comments
 (0)