@@ -79,17 +79,18 @@ type PhaseReconciler struct {
79
79
providerLister ProviderLister
80
80
providerConverter ProviderConverter
81
81
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
93
94
}
94
95
95
96
// PhaseReconcilerOption is a function that configures the reconciler.
@@ -123,6 +124,13 @@ func WithProviderMapper(providerMapper ProviderMapper) PhaseReconcilerOption {
123
124
}
124
125
}
125
126
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
+
126
134
// PhaseFn is a function that represent a phase of the reconciliation.
127
135
type PhaseFn func (context.Context ) (* Result , error )
128
136
@@ -616,6 +624,12 @@ func (p *PhaseReconciler) Fetch(ctx context.Context) (*Result, error) {
616
624
return & Result {}, wrapPhaseError (err , operatorv1 .ComponentsImageOverrideErrorReason , operatorv1 .ProviderInstalledCondition )
617
625
}
618
626
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
+
619
633
return & Result {}, nil
620
634
}
621
635
0 commit comments