@@ -57,12 +57,12 @@ const (
5757// helps to iterate through provider reconciliation phases.
5858type PhaseReconciler [P generic.Provider , G generic.Group [P ]] struct {
5959 ctrlClient client.Client
60- repo repository.Repository
61- contract string
62- options repository.ComponentsOptions
63- providerConfig configclient.Provider
64- configClient configclient.Client
65- components repository.Components
60+ Repo repository.Repository
61+ Contract string
62+ Options repository.ComponentsOptions
63+ ProviderConfig configclient.Provider
64+ ConfigClient configclient.Client
65+ Components repository.Components
6666}
6767
6868type Phase [P generic.Provider ] struct {
@@ -180,14 +180,14 @@ func (p *PhaseReconciler[P, G]) InitializePhaseReconciler(ctx context.Context, p
180180 }
181181
182182 // Load provider's secret and config url.
183- p .configClient , err = configclient .New (ctx , "" , configclient .InjectReader (reader ))
183+ p .ConfigClient , err = configclient .New (ctx , "" , configclient .InjectReader (reader ))
184184 if err != nil {
185185 return reconcile.Result {}, wrapPhaseError (err , "failed to load the secret reader" , operatorv1 .ProviderInstalledCondition )
186186 }
187187
188188 // Get returns the configuration for the provider with a given name/type.
189189 // This is done using clusterctl internal API types.
190- p .providerConfig , err = p .configClient .Providers ().Get (phase .GetProvider ().GetName (), phase .ClusterctlProviderType ())
190+ p .ProviderConfig , err = p .ConfigClient .Providers ().Get (phase .GetProvider ().GetName (), phase .ClusterctlProviderType ())
191191 if err != nil {
192192 return reconcile.Result {}, wrapPhaseError (err , operatorv1 .UnknownProviderReason , operatorv1 .ProviderInstalledCondition )
193193 }
@@ -219,14 +219,14 @@ func (p *PhaseReconciler[P, G]) Load(ctx context.Context, phase G) (reconcile.Re
219219 return reconcile.Result {}, wrapPhaseError (err , "failed to load additional manifests" , operatorv1 .ProviderInstalledCondition )
220220 }
221221
222- p .repo , err = configmapRepository (ctx , phase .GetClient (), labelSelector , phase .GetProvider ().GetNamespace (), additionalManifests )
222+ p .Repo , err = configmapRepository (ctx , phase .GetClient (), labelSelector , phase .GetProvider ().GetNamespace (), additionalManifests )
223223 if err != nil {
224224 return reconcile.Result {}, wrapPhaseError (err , "failed to load the repository" , operatorv1 .ProviderInstalledCondition )
225225 }
226226
227227 if spec .Version == "" {
228228 // User didn't set the version, so we need to find the latest one from the matching config maps.
229- repoVersions , err := p .repo .GetVersions (ctx )
229+ repoVersions , err := p .Repo .GetVersions (ctx )
230230 if err != nil {
231231 return reconcile.Result {}, wrapPhaseError (err , fmt .Sprintf ("failed to get a list of available versions for provider %q" , phase .GetProvider ().GetName ()), operatorv1 .ProviderInstalledCondition )
232232 }
@@ -241,7 +241,7 @@ func (p *PhaseReconciler[P, G]) Load(ctx context.Context, phase G) (reconcile.Re
241241 }
242242
243243 // Store some provider specific inputs for passing it to clusterctl library
244- p .options = repository.ComponentsOptions {
244+ p .Options = repository.ComponentsOptions {
245245 TargetNamespace : phase .GetProvider ().GetNamespace (),
246246 SkipTemplateProcess : false ,
247247 Version : spec .Version ,
@@ -422,7 +422,7 @@ func getComponentsData(cm corev1.ConfigMap) (string, error) {
422422func (p * PhaseReconciler [P , G ]) validateRepoCAPIVersion (ctx context.Context , phase G ) error {
423423 name := phase .GetProvider ().GetName ()
424424
425- file , err := p .repo .GetFile (ctx , p .options .Version , metadataFile )
425+ file , err := p .Repo .GetFile (ctx , p .Options .Version , metadataFile )
426426 if err != nil {
427427 return fmt .Errorf ("failed to read %q from the repository for provider %q: %w" , metadataFile , name , err )
428428 }
@@ -436,21 +436,21 @@ func (p *PhaseReconciler[P, G]) validateRepoCAPIVersion(ctx context.Context, pha
436436 }
437437
438438 // Gets the contract for the target release.
439- targetVersion , err := versionutil .ParseSemantic (p .options .Version )
439+ targetVersion , err := versionutil .ParseSemantic (p .Options .Version )
440440 if err != nil {
441441 return fmt .Errorf ("failed to parse current version for the %s provider: %w" , name , err )
442442 }
443443
444444 releaseSeries := latestMetadata .GetReleaseSeriesForVersion (targetVersion )
445445 if releaseSeries == nil {
446- return fmt .Errorf ("invalid provider metadata: version %s for the provider %s does not match any release series" , p .options .Version , name )
446+ return fmt .Errorf ("invalid provider metadata: version %s for the provider %s does not match any release series" , p .Options .Version , name )
447447 }
448448
449449 if releaseSeries .Contract != "v1alpha4" && releaseSeries .Contract != "v1beta1" {
450450 return fmt .Errorf (capiVersionIncompatibilityMessage , clusterv1 .GroupVersion .Version , releaseSeries .Contract , name )
451451 }
452452
453- p .contract = releaseSeries .Contract
453+ p .Contract = releaseSeries .Contract
454454
455455 return nil
456456}
@@ -461,35 +461,35 @@ func (p *PhaseReconciler[P, G]) Fetch(ctx context.Context, phase G) (reconcile.R
461461 log .Info ("Fetching provider" )
462462
463463 // Fetch the provider components yaml file from the provided repository GitHub/GitLab/ConfigMap.
464- componentsFile , err := p .repo .GetFile (ctx , p .options .Version , p .repo .ComponentsPath ())
464+ componentsFile , err := p .Repo .GetFile (ctx , p .Options .Version , p .Repo .ComponentsPath ())
465465 if err != nil {
466- err = fmt .Errorf ("failed to read %q from provider's repository %q: %w" , p .repo .ComponentsPath (), p .providerConfig .ManifestLabel (), err )
466+ err = fmt .Errorf ("failed to read %q from provider's repository %q: %w" , p .Repo .ComponentsPath (), p .ProviderConfig .ManifestLabel (), err )
467467
468468 return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 .ProviderInstalledCondition )
469469 }
470470
471471 // Generate a set of new objects using the clusterctl library. NewComponents() will do the yaml processing,
472472 // like ensure all the provider components are in proper namespace, replace variables, etc. See the clusterctl
473473 // documentation for more details.
474- p .components , err = repository .NewComponents (repository.ComponentsInput {
475- Provider : p .providerConfig ,
476- ConfigClient : p .configClient ,
474+ p .Components , err = repository .NewComponents (repository.ComponentsInput {
475+ Provider : p .ProviderConfig ,
476+ ConfigClient : p .ConfigClient ,
477477 Processor : yamlprocessor .NewSimpleProcessor (),
478478 RawYaml : componentsFile ,
479- Options : p .options ,
479+ Options : p .Options ,
480480 })
481481 if err != nil {
482482 return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 .ProviderInstalledCondition )
483483 }
484484
485485 // ProviderSpec provides fields for customizing the provider deployment options.
486486 // We can use clusterctl library to apply this customizations.
487- if err := repository .AlterComponents (p .components , customizeObjectsFn (phase .GetProvider ())); err != nil {
487+ if err := repository .AlterComponents (p .Components , customizeObjectsFn (phase .GetProvider ())); err != nil {
488488 return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 .ProviderInstalledCondition )
489489 }
490490
491491 // Apply patches to the provider components if specified.
492- if err := repository .AlterComponents (p .components , applyPatches (ctx , phase .GetProvider ())); err != nil {
492+ if err := repository .AlterComponents (p .Components , applyPatches (ctx , phase .GetProvider ())); err != nil {
493493 return reconcile.Result {}, wrapPhaseError (err , operatorv1 .ComponentsFetchErrorReason , operatorv1 .ProviderInstalledCondition )
494494 }
495495
@@ -541,7 +541,7 @@ func (p *PhaseReconciler[P, G]) Install(ctx context.Context, phase G) (reconcile
541541
542542 log .Info ("Installing provider" )
543543
544- if err := clusterClient .ProviderComponents ().Create (ctx , p .components .Objs ()); err != nil {
544+ if err := clusterClient .ProviderComponents ().Create (ctx , p .Components .Objs ()); err != nil {
545545 reason := "Install failed"
546546 if wait .Interrupted (err ) {
547547 reason = "Timed out waiting for deployment to become ready"
@@ -558,8 +558,8 @@ func (p *PhaseReconciler[P, G]) Install(ctx context.Context, phase G) (reconcile
558558
559559func (p * PhaseReconciler [P , G ]) ReportStatus (_ context.Context , phase G ) (reconcile.Result , error ) {
560560 status := phase .GetProvider ().GetStatus ()
561- status .Contract = & p .contract
562- installedVersion := p .components .Version ()
561+ status .Contract = & p .Contract
562+ installedVersion := p .Components .Version ()
563563 status .InstalledVersion = & installedVersion
564564 phase .GetProvider ().SetStatus (status )
565565
@@ -589,9 +589,9 @@ func (p *PhaseReconciler[P, G]) Delete(ctx context.Context, phase G) (reconcile.
589589}
590590
591591func (p * PhaseReconciler [P , G ]) repositoryProxy (ctx context.Context , provider configclient.Provider , configClient configclient.Client , options ... repository.Option ) (repository.Client , error ) {
592- injectRepo := p .repo
592+ injectRepo := p .Repo
593593
594- if ! provider .SameAs (p .providerConfig ) {
594+ if ! provider .SameAs (p .ProviderConfig ) {
595595 genericProvider , err := GetGenericProvider (ctx , p .ctrlClient , provider )
596596 if err != nil {
597597 return nil , wrapPhaseError (err , "unable to find generic provider for configclient " + string (provider .Type ())+ ": " + provider .Name (), operatorv1 .ProviderUpgradedCondition )
@@ -619,7 +619,7 @@ func (p *PhaseReconciler[P, G]) repositoryProxy(ctx context.Context, provider co
619619 return nil , err
620620 }
621621
622- return proxy.RepositoryProxy {Client : cl , RepositoryComponents : p .components }, nil
622+ return proxy.RepositoryProxy {Client : cl , RepositoryComponents : p .Components }, nil
623623}
624624
625625// GetGenericProvider returns the first of generic providers matching the type and the name from the configclient.Provider.
@@ -645,7 +645,7 @@ func GetGenericProvider(ctx context.Context, cl client.Client, provider configcl
645645
646646// newClusterClient returns a clusterctl client for interacting with management cluster.
647647func newClusterClient [P generic.Provider , G generic.Group [P ]](p * PhaseReconciler [P , G ], phase G ) cluster.Client {
648- return cluster .New (cluster.Kubeconfig {}, p .configClient , cluster .InjectProxy (& proxy.ControllerProxy {
648+ return cluster .New (cluster.Kubeconfig {}, p .ConfigClient , cluster .InjectProxy (& proxy.ControllerProxy {
649649 CtrlClient : proxy.ClientProxy {
650650 Client : phase .GetClient (),
651651 ListProviders : listProviders ,
0 commit comments