@@ -153,11 +153,13 @@ func (optr *Operator) syncAvailableUpdates(ctx context.Context, config *configv1
153153 condition .Reason == "ResponseInvalid" ))
154154 if ! responseFailed || (responseFailed && ! preserveCacheOnFailure ) {
155155 optrAvailableUpdates .Current = current
156- optrAvailableUpdates .Updates = updates
157- optrAvailableUpdates .ConditionalUpdates = conditionalUpdates
156+ optrAvailableUpdates .upstreamUpdates = updates
157+ optrAvailableUpdates .upstreamConditionalUpdates = conditionalUpdates
158158 }
159159 }
160160
161+ optrAvailableUpdates .Updates = deepCopyReleases (optrAvailableUpdates .upstreamUpdates )
162+ optrAvailableUpdates .ConditionalUpdates = deepCopyConditionalUpdates (optrAvailableUpdates .upstreamConditionalUpdates )
161163 optrAvailableUpdates .AcceptRisks = acceptRisks
162164 optrAvailableUpdates .ShouldReconcileAcceptRisks = optr .shouldReconcileAcceptRisks
163165 optrAvailableUpdates .risks = optr .risks
@@ -205,10 +207,12 @@ type availableUpdates struct {
205207 // slice was empty.
206208 LastSyncOrConfigChange time.Time
207209
208- Current configv1.Release
209- Updates []configv1.Release
210- ConditionalUpdates []configv1.ConditionalUpdate
211- ConditionRegistry clusterconditions.ConditionRegistry
210+ Current configv1.Release
211+ Updates []configv1.Release
212+ upstreamUpdates []configv1.Release
213+ ConditionalUpdates []configv1.ConditionalUpdate
214+ upstreamConditionalUpdates []configv1.ConditionalUpdate
215+ ConditionRegistry clusterconditions.ConditionRegistry
212216
213217 Condition configv1.ClusterOperatorStatusCondition
214218
@@ -332,22 +336,46 @@ func (optr *Operator) getAvailableUpdates() *availableUpdates {
332336 }
333337
334338 if optr .availableUpdates .Updates != nil {
335- u .Updates = make ([]configv1.Release , 0 , len (optr .availableUpdates .Updates ))
336- for _ , update := range optr .availableUpdates .Updates {
337- u .Updates = append (u .Updates , * update .DeepCopy ())
338- }
339+ u .Updates = deepCopyReleases (optr .availableUpdates .Updates )
340+ }
341+
342+ if optr .availableUpdates .upstreamUpdates != nil {
343+ u .upstreamUpdates = deepCopyReleases (optr .availableUpdates .upstreamUpdates )
339344 }
340345
341346 if optr .availableUpdates .ConditionalUpdates != nil {
342- u .ConditionalUpdates = make ([]configv1.ConditionalUpdate , 0 , len (optr .availableUpdates .ConditionalUpdates ))
343- for _ , conditionalUpdate := range optr .availableUpdates .ConditionalUpdates {
344- u .ConditionalUpdates = append (u .ConditionalUpdates , * conditionalUpdate .DeepCopy ())
345- }
347+ u .ConditionalUpdates = deepCopyConditionalUpdates (optr .availableUpdates .ConditionalUpdates )
348+ }
349+
350+ if optr .availableUpdates .upstreamConditionalUpdates != nil {
351+ u .upstreamConditionalUpdates = deepCopyConditionalUpdates (optr .availableUpdates .upstreamConditionalUpdates )
346352 }
347353
348354 return u
349355}
350356
357+ func deepCopyReleases (releases []configv1.Release ) []configv1.Release {
358+ if releases == nil {
359+ return nil
360+ }
361+ c := make ([]configv1.Release , 0 , len (releases ))
362+ for _ , update := range releases {
363+ c = append (c , * update .DeepCopy ())
364+ }
365+ return c
366+ }
367+
368+ func deepCopyConditionalUpdates (updates []configv1.ConditionalUpdate ) []configv1.ConditionalUpdate {
369+ if updates == nil {
370+ return nil
371+ }
372+ c := make ([]configv1.ConditionalUpdate , 0 , len (updates ))
373+ for _ , update := range updates {
374+ c = append (c , * update .DeepCopy ())
375+ }
376+ return c
377+ }
378+
351379func loadRiskConditions (ctx context.Context , risks []string , riskVersions map [string ]riskWithVersion , conditionRegistry clusterconditions.ConditionRegistry ) map [string ][]metav1.Condition {
352380 riskConditions := map [string ][]metav1.Condition {}
353381 for _ , riskName := range risks {
0 commit comments