Skip to content

Commit 5eab9b4

Browse files
Allow upgrade from v1beta1
1 parent 38c997b commit 5eab9b4

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cmd/clusterctl/client/upgrade.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"github.com/pkg/errors"
2525
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2626

27+
clusterv1beta1 "sigs.k8s.io/cluster-api/api/v1beta1"
2728
clusterv1 "sigs.k8s.io/cluster-api/api/v1beta2"
2829
clusterctlv1 "sigs.k8s.io/cluster-api/cmd/clusterctl/api/v1alpha3"
2930
"sigs.k8s.io/cluster-api/cmd/clusterctl/client/cluster"
@@ -56,8 +57,9 @@ func (c *clusterctlClient) PlanUpgrade(ctx context.Context, options PlanUpgradeO
5657
return nil, err
5758
}
5859

59-
// Ensure this command only runs against management clusters with the current Cluster API contract.
60-
if err := clusterClient.ProviderInventory().CheckCAPIContract(ctx); err != nil {
60+
// Ensure this command only runs against management clusters with the current Cluster API contract;
61+
// temporarily we also allow upgrading from v1beta1 to allow transition to the current Cluster API contract.
62+
if err := clusterClient.ProviderInventory().CheckCAPIContract(ctx, cluster.AllowCAPIContract{Contract: clusterv1beta1.GroupVersion.Version}); err != nil {
6163
return nil, err
6264
}
6365

@@ -145,8 +147,9 @@ func (c *clusterctlClient) ApplyUpgrade(ctx context.Context, options ApplyUpgrad
145147
return err
146148
}
147149

148-
// Ensure this command only runs against management clusters with the current Cluster API contract.
149-
if err := clusterClient.ProviderInventory().CheckCAPIContract(ctx); err != nil {
150+
// Ensure this command only runs against management clusters with the current Cluster API contract;
151+
// temporarily we also allow upgrading from v1beta1 to allow transition to the current Cluster API contract.
152+
if err := clusterClient.ProviderInventory().CheckCAPIContract(ctx, cluster.AllowCAPIContract{Contract: clusterv1beta1.GroupVersion.Version}); err != nil {
150153
return err
151154
}
152155

0 commit comments

Comments
 (0)