Skip to content

Commit 9b25c87

Browse files
committed
availableupdates: Refactor getting desired/current architecture
1 parent c64d655 commit 9b25c87

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

pkg/cvo/availableupdates.go

Lines changed: 9 additions & 10 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 = string(configv1.ClusterVersionArchitectureMulti)
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()
@@ -330,7 +322,14 @@ func (optr *Operator) getDesiredArchitecture(update *configv1.Update) string {
330322
if update != nil {
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)