@@ -295,6 +295,18 @@ func (w *SyncWorker) syncPayload(ctx context.Context, work *SyncWork) ([]configv
295295
296296 // cache the payload until the release image changes
297297 validPayload := w .payload
298+
299+ previousEnabledFeatureGates := w .status .EnabledFeatureGates
300+ if ! work .EnabledFeatureGates .Equal (previousEnabledFeatureGates ) {
301+ // When the feature gates change, we must reload the payload.
302+ // Loading the payload filters out files that didn't match the previous set of feature gates,
303+ // this means now, additional files may match the new set of feature gates and need to be included.
304+ // Some files in the current payload may no longer match the new set of feature gates and need to be excluded,
305+ // though these ones are already excluded when apply calls Include on the manifests.
306+ klog .V (2 ).Infof ("Enabled feature gates changed from %v to %v, forcing a payload refresh" , previousEnabledFeatureGates , work .EnabledFeatureGates )
307+ w .payload = nil
308+ }
309+
298310 if validPayload != nil && validPayload .Release .Image == desired .Image {
299311
300312 // reset payload status to currently loaded payload if it no longer applies to desired target
@@ -651,15 +663,12 @@ func (w *SyncWorker) Start(ctx context.Context, maxWorkers int) {
651663
652664 if featureGatesChanged {
653665 // When the feature gates change, we must reload the payload.
654- // Loading the payload fiters out files that didn't match the previous set of feature gates,
666+ // Loading the payload filters out files that didn't match the previous set of feature gates,
655667 // this means now, additional files may match the new set of feature gates and need to be included.
656668 // Some files in the current payload may no longer match the new set of feature gates and need to be excluded,
657669 // though these ones are already excluded when apply calls Include on the manifests.
658670 klog .V (2 ).Infof ("Feature gates changed, loading updated payload" )
659671
660- // Clear the payload to force a reload.
661- w .payload = nil
662-
663672 _ , err := w .loadUpdatedPayload (ctx , w .work )
664673 if err != nil {
665674 klog .Warningf ("Error when attempting to load updated payload: %v." , err )
0 commit comments