@@ -79,17 +79,18 @@ type PhaseReconciler struct {
7979 providerLister ProviderLister
8080 providerConverter ProviderConverter
8181
82- ctrlClient client.Client
83- ctrlConfig * rest.Config
84- repo repository.Repository
85- contract string
86- options repository.ComponentsOptions
87- providerConfig configclient.Provider
88- configClient configclient.Client
89- overridesClient configclient.Client
90- components repository.Components
91- clusterctlProvider * clusterctlv1.Provider
92- needsCompression bool
82+ ctrlClient client.Client
83+ ctrlConfig * rest.Config
84+ repo repository.Repository
85+ contract string
86+ options repository.ComponentsOptions
87+ providerConfig configclient.Provider
88+ configClient configclient.Client
89+ overridesClient configclient.Client
90+ components repository.Components
91+ clusterctlProvider * clusterctlv1.Provider
92+ needsCompression bool
93+ customAlterComponentsFuncs []repository.ComponentsAlterFn
9394}
9495
9596// PhaseReconcilerOption is a function that configures the reconciler.
@@ -123,6 +124,13 @@ func WithProviderMapper(providerMapper ProviderMapper) PhaseReconcilerOption {
123124 }
124125}
125126
127+ // WithCustomAlterComponentsFuncs configures the reconciler to use the given custom alter components functions.
128+ func WithCustomAlterComponentsFuncs (fns []repository.ComponentsAlterFn ) PhaseReconcilerOption {
129+ return func (r * PhaseReconciler ) {
130+ r .customAlterComponentsFuncs = fns
131+ }
132+ }
133+
126134// PhaseFn is a function that represent a phase of the reconciliation.
127135type PhaseFn func (context.Context ) (* Result , error )
128136
@@ -616,6 +624,12 @@ func (p *PhaseReconciler) Fetch(ctx context.Context) (*Result, error) {
616624 return & Result {}, wrapPhaseError (err , operatorv1 .ComponentsImageOverrideErrorReason , operatorv1 .ProviderInstalledCondition )
617625 }
618626
627+ for _ , fn := range p .customAlterComponentsFuncs {
628+ if err := repository .AlterComponents (p .components , fn ); err != nil {
629+ return & Result {}, wrapPhaseError (err , operatorv1 .ComponentsCustomizationErrorReason , operatorv1 .ProviderInstalledCondition )
630+ }
631+ }
632+
619633 return & Result {}, nil
620634}
621635
0 commit comments