@@ -179,15 +179,13 @@ func (r *HelmOpReconciler) createUpdateBundle(ctx context.Context, helmop *fleet
179179
180180 // Resolve the Rancher CA bundle in the controller and store it in HelmOpOptions so
181181 // the agent (whose service account cannot read cattle-system secrets) can use it.
182- // The resolved bundle is also forwarded to handleVersion so getChartVersion can reuse
183- // it without a second cattle-system lookup.
184182 cab , err := cert .GetRancherCABundle (ctx , r .Client )
185183 if err != nil {
186184 return nil , fmt .Errorf ("could not get Rancher CA bundle: %w" , err )
187185 }
188186 bundle .Spec .HelmOpOptions .CABundle = cab
189187
190- if err := r .handleVersion (ctx , b , bundle , helmop , cab ); err != nil {
188+ if err := r .handleVersion (ctx , b , bundle , helmop ); err != nil {
191189 return nil , err
192190 }
193191
@@ -262,10 +260,7 @@ func (r *HelmOpReconciler) calculateBundle(helmop *fleet.HelmOp) *fleet.Bundle {
262260//
263261// This is calculated in the upstream cluster so all downstream bundle deployments have the same
264262// version. (Potentially we could be gathering the version at the very moment it is being updated, for example)
265- //
266- // caBundle is an optional pre-resolved CA bundle (may be nil). When non-nil it is forwarded to
267- // getChartVersion so a second cattle-system secret lookup is avoided.
268- func (r * HelmOpReconciler ) handleVersion (ctx context.Context , oldBundle * fleet.Bundle , bundle * fleet.Bundle , helmop * fleet.HelmOp , caBundle []byte ) error {
263+ func (r * HelmOpReconciler ) handleVersion (ctx context.Context , oldBundle * fleet.Bundle , bundle * fleet.Bundle , helmop * fleet.HelmOp ) error {
269264 if helmop == nil {
270265 return fmt .Errorf ("the provided HelmOp is nil; this should not happen" )
271266 }
@@ -276,7 +271,7 @@ func (r *HelmOpReconciler) handleVersion(ctx context.Context, oldBundle *fleet.B
276271 return nil
277272 }
278273
279- version , err := getChartVersion (ctx , r .Client , * helmop , caBundle )
274+ version , err := getChartVersion (ctx , r .Client , * helmop , bundle . Spec . HelmOpOptions . CABundle )
280275 if err != nil {
281276 return err
282277 }
0 commit comments