diff --git a/cmd/clusterctl/client/cluster/cert_manager.go b/cmd/clusterctl/client/cluster/cert_manager.go index a679e3a5b0b5..a99119ac35a7 100644 --- a/cmd/clusterctl/client/cluster/cert_manager.go +++ b/cmd/clusterctl/client/cluster/cert_manager.go @@ -289,7 +289,7 @@ func (cm *certManagerClient) migrateCRDs(ctx context.Context) error { return err } - return newCRDMigrator(c).Run(ctx, objs) + return NewCRDMigrator(c).Run(ctx, objs) } func (cm *certManagerClient) deleteObjs(ctx context.Context, objs []unstructured.Unstructured) error { diff --git a/cmd/clusterctl/client/cluster/crd_migration.go b/cmd/clusterctl/client/cluster/crd_migration.go index cd770bd79620..17870b0017b9 100644 --- a/cmd/clusterctl/client/cluster/crd_migration.go +++ b/cmd/clusterctl/client/cluster/crd_migration.go @@ -35,6 +35,11 @@ import ( logf "sigs.k8s.io/cluster-api/cmd/clusterctl/log" ) +// CRDMigrator interface defines methods for migrating CRs to the storage version of new CRDs. +type CRDMigrator interface { + Run(ctx context.Context, objs []unstructured.Unstructured) error +} + // crdMigrator migrates CRs to the storage version of new CRDs. // This is necessary when the new CRD drops a version which // was previously used as a storage version. @@ -42,8 +47,8 @@ type crdMigrator struct { Client client.Client } -// newCRDMigrator creates a new CRD migrator. -func newCRDMigrator(client client.Client) *crdMigrator { +// NewCRDMigrator creates a new CRD migrator. +func NewCRDMigrator(client client.Client) CRDMigrator { return &crdMigrator{ Client: client, } diff --git a/cmd/clusterctl/client/cluster/upgrader.go b/cmd/clusterctl/client/cluster/upgrader.go index ee45791f2839..9f1842671b84 100644 --- a/cmd/clusterctl/client/cluster/upgrader.go +++ b/cmd/clusterctl/client/cluster/upgrader.go @@ -382,7 +382,7 @@ func (u *providerUpgrader) doUpgrade(ctx context.Context, upgradePlan *UpgradePl return err } - if err := newCRDMigrator(c).Run(ctx, components.Objs()); err != nil { + if err := NewCRDMigrator(c).Run(ctx, components.Objs()); err != nil { return err } }