Skip to content

Commit

Permalink
Update all CAPA v1beta1 references to v1beta2
Browse files Browse the repository at this point in the history
Updates all references utilizing "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" to "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2". Also updated all related import aliases to capiaws.

Signed-off-by: Bryan Cox <[email protected]>
  • Loading branch information
bryan-cox committed Dec 22, 2022
1 parent 5acd3f6 commit 15a4f89
Show file tree
Hide file tree
Showing 13 changed files with 43 additions and 43 deletions.
2 changes: 1 addition & 1 deletion api/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
"k8s.io/apimachinery/pkg/runtime/serializer/json"
kasv1beta1 "k8s.io/apiserver/pkg/apis/apiserver/v1beta1"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiazure "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
capiibm "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1"
Expand Down
2 changes: 1 addition & 1 deletion api/v1alpha1/capi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package v1alpha1

// These imports are used to explicitly declare external API dependencies
import (
_ "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
_ "sigs.k8s.io/cluster-api-provider-aws/exp/api/v1beta1"
_ "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
_ "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
_ "sigs.k8s.io/cluster-api/api/v1beta1"
_ "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/capi_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ package v1beta1

// These imports are used to explicitly declare external API dependencies
import (
_ "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
_ "sigs.k8s.io/cluster-api-provider-aws/exp/api/v1beta1"
_ "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
_ "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
_ "sigs.k8s.io/cluster-api/api/v1beta1"
_ "sigs.k8s.io/cluster-api/exp/addons/api/v1beta1"
Expand Down
2 changes: 1 addition & 1 deletion cmd/cluster/core/dump.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"k8s.io/apimachinery/pkg/labels"
kubeclient "k8s.io/client-go/kubernetes"
restclient "k8s.io/client-go/rest"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ import (
"k8s.io/client-go/util/workqueue"
"k8s.io/utils/clock"
k8sutilspointer "k8s.io/utils/pointer"
capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1" // Need this dep atm to satisfy IBM provider dep.
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2" // Need this dep atm to satisfy IBM provider dep.
capiibmv1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
Expand Down Expand Up @@ -206,7 +206,7 @@ func (r *HostedClusterReconciler) SetupWithManager(mgr ctrl.Manager, createOrUpd
// managedResources are all the resources that are managed as childresources for a HostedCluster
func (r *HostedClusterReconciler) managedResources() []client.Object {
managedResources := []client.Object{
&capiawsv1.AWSCluster{},
&capiaws.AWSCluster{},
&hyperv1.HostedControlPlane{},
&capiv1.Cluster{},
&appsv1.Deployment{},
Expand Down Expand Up @@ -3930,13 +3930,13 @@ func (r *HostedClusterReconciler) reconcileAWSSubnets(ctx context.Context, creat

// Reconcile subnet IDs in AWSCluster
// TODO (alberto): drop this once this is fixed upstream https://github.com/kubernetes-sigs/cluster-api-provider-aws/pull/2864.
awsInfraCR, ok := infraCR.(*capiawsv1.AWSCluster)
awsInfraCR, ok := infraCR.(*capiaws.AWSCluster)
if !ok {
return nil
}
subnets := capiawsv1.Subnets{}
subnets := capiaws.Subnets{}
for _, subnetID := range subnetIDs {
subnets = append(subnets, capiawsv1.SubnetSpec{ID: subnetID})
subnets = append(subnets, capiaws.SubnetSpec{ID: subnetID})
}
_, err = createOrUpdate(ctx, r.Client, awsInfraCR, func() error {
awsInfraCR.Spec.NetworkSpec.Subnets = subnets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (
"k8s.io/utils/clock"
clocktesting "k8s.io/utils/clock/testing"
"k8s.io/utils/pointer"
capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capibmv1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
"sigs.k8s.io/cluster-api/api/v1beta1"
ctrl "sigs.k8s.io/controller-runtime"
Expand Down Expand Up @@ -618,10 +618,10 @@ func TestReconcileCAPICluster(t *testing.T) {
Name: "cluster1",
},
},
infraCR: &capiawsv1.AWSCluster{
infraCR: &capiaws.AWSCluster{
TypeMeta: metav1.TypeMeta{
Kind: "AWSCluster",
APIVersion: capiawsv1.GroupVersion.String(),
APIVersion: capiaws.GroupVersion.String(),
},
ObjectMeta: metav1.ObjectMeta{
Name: "cluster1",
Expand All @@ -645,7 +645,7 @@ func TestReconcileCAPICluster(t *testing.T) {
Name: "cluster1",
},
InfrastructureRef: &corev1.ObjectReference{
APIVersion: capiawsv1.GroupVersion.String(),
APIVersion: capiaws.GroupVersion.String(),
Kind: "AWSCluster",
Namespace: "master-cluster1",
Name: "cluster1",
Expand Down Expand Up @@ -1026,12 +1026,12 @@ func TestReconcileAWSSubnets(t *testing.T) {

infraCRName := "test"
hcpNamespace := "hcp"
infraCR := &capiawsv1.AWSCluster{
infraCR := &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{
Name: infraCRName,
Namespace: hcpNamespace,
},
Spec: capiawsv1.AWSClusterSpec{},
Spec: capiaws.AWSClusterSpec{},
}

client := fake.NewClientBuilder().WithScheme(api.Scheme).WithObjects(infraCR, nodePool, nodePool2).Build()
Expand All @@ -1045,14 +1045,14 @@ func TestReconcileAWSSubnets(t *testing.T) {
err := r.reconcileAWSSubnets(context.Background(), createOrUpdate, infraCR, req.Namespace, req.Name, hcpNamespace)
g.Expect(err).ToNot(HaveOccurred())

freshInfraCR := &capiawsv1.AWSCluster{
freshInfraCR := &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{
Name: infraCRName,
Namespace: hcpNamespace,
}}
err = client.Get(context.Background(), crclient.ObjectKeyFromObject(freshInfraCR), freshInfraCR)
g.Expect(err).ToNot(HaveOccurred())
g.Expect(freshInfraCR.Spec.NetworkSpec.Subnets).To(BeEquivalentTo([]capiawsv1.SubnetSpec{
g.Expect(freshInfraCR.Spec.NetworkSpec.Subnets).To(BeEquivalentTo([]capiaws.SubnetSpec{
{
ID: "1",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
k8sutilspointer "k8s.io/utils/pointer"
capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
)
Expand Down Expand Up @@ -48,7 +48,7 @@ func (p AWS) ReconcileCAPIInfraCR(ctx context.Context, c client.Client, createOr
controlPlaneNamespace string,
apiEndpoint hyperv1.APIEndpoint,
) (client.Object, error) {
awsCluster := &capiawsv1.AWSCluster{
awsCluster := &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{
Namespace: controlPlaneNamespace,
Name: hcluster.Name,
Expand Down Expand Up @@ -307,7 +307,7 @@ func (AWS) ReconcileSecretEncryption(ctx context.Context, c client.Client, creat
return nil
}

func reconcileAWSCluster(awsCluster *capiawsv1.AWSCluster, hcluster *hyperv1.HostedCluster, apiEndpoint hyperv1.APIEndpoint) error {
func reconcileAWSCluster(awsCluster *capiaws.AWSCluster, hcluster *hyperv1.HostedCluster, apiEndpoint hyperv1.APIEndpoint) error {
// We only create this resource once and then let CAPI own it
awsCluster.Annotations = map[string]string{
capiv1.ManagedByAnnotation: "external",
Expand All @@ -322,7 +322,7 @@ func reconcileAWSCluster(awsCluster *capiawsv1.AWSCluster, hcluster *hyperv1.Hos
}

if len(hcluster.Spec.Platform.AWS.ResourceTags) > 0 {
awsCluster.Spec.AdditionalTags = capiawsv1.Tags{}
awsCluster.Spec.AdditionalTags = capiaws.Tags{}
}
for _, entry := range hcluster.Spec.Platform.AWS.ResourceTags {
awsCluster.Spec.AdditionalTags[entry.Key] = entry.Value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,41 @@ import (
"github.com/google/go-cmp/cmp"
hyperv1 "github.com/openshift/hypershift/api/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
capiawsv1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
)

func TestReconcileAWSCluster(t *testing.T) {
testCases := []struct {
name string
initialAWSCluster *capiawsv1.AWSCluster
initialAWSCluster *capiaws.AWSCluster
hostedCluster *hyperv1.HostedCluster

expectedAWSCluster *capiawsv1.AWSCluster
expectedAWSCluster *capiaws.AWSCluster
}{
{
name: "Tags get copied over",
initialAWSCluster: &capiawsv1.AWSCluster{},
initialAWSCluster: &capiaws.AWSCluster{},
hostedCluster: &hyperv1.HostedCluster{Spec: hyperv1.HostedClusterSpec{Platform: hyperv1.PlatformSpec{AWS: &hyperv1.AWSPlatformSpec{
ResourceTags: []hyperv1.AWSResourceTag{
{Key: "foo", Value: "bar"},
},
}}}},

expectedAWSCluster: &capiawsv1.AWSCluster{
expectedAWSCluster: &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
"cluster.x-k8s.io/managed-by": "external",
}},
Spec: capiawsv1.AWSClusterSpec{
AdditionalTags: capiawsv1.Tags{"foo": "bar"},
Spec: capiaws.AWSClusterSpec{
AdditionalTags: capiaws.Tags{"foo": "bar"},
},
Status: capiawsv1.AWSClusterStatus{
Status: capiaws.AWSClusterStatus{
Ready: true,
},
},
},
{
name: "Existing tags get removed",
initialAWSCluster: &capiawsv1.AWSCluster{Spec: capiawsv1.AWSClusterSpec{AdditionalTags: capiawsv1.Tags{
initialAWSCluster: &capiaws.AWSCluster{Spec: capiaws.AWSClusterSpec{AdditionalTags: capiaws.Tags{
"to-be-removed": "value",
}}},
hostedCluster: &hyperv1.HostedCluster{Spec: hyperv1.HostedClusterSpec{Platform: hyperv1.PlatformSpec{AWS: &hyperv1.AWSPlatformSpec{
Expand All @@ -49,30 +49,30 @@ func TestReconcileAWSCluster(t *testing.T) {
},
}}}},

expectedAWSCluster: &capiawsv1.AWSCluster{
expectedAWSCluster: &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
"cluster.x-k8s.io/managed-by": "external",
}},
Spec: capiawsv1.AWSClusterSpec{
AdditionalTags: capiawsv1.Tags{"foo": "bar"},
Spec: capiaws.AWSClusterSpec{
AdditionalTags: capiaws.Tags{"foo": "bar"},
},
Status: capiawsv1.AWSClusterStatus{
Status: capiaws.AWSClusterStatus{
Ready: true,
},
},
},
{
name: "No tags on hostedcluster clears existing awscluster tags",
initialAWSCluster: &capiawsv1.AWSCluster{Spec: capiawsv1.AWSClusterSpec{AdditionalTags: capiawsv1.Tags{
initialAWSCluster: &capiaws.AWSCluster{Spec: capiaws.AWSClusterSpec{AdditionalTags: capiaws.Tags{
"to-be-removed": "value",
}}},
hostedCluster: &hyperv1.HostedCluster{},

expectedAWSCluster: &capiawsv1.AWSCluster{
expectedAWSCluster: &capiaws.AWSCluster{
ObjectMeta: metav1.ObjectMeta{Annotations: map[string]string{
"cluster.x-k8s.io/managed-by": "external",
}},
Status: capiawsv1.AWSClusterStatus{
Status: capiaws.AWSClusterStatus{
Ready: true,
},
},
Expand Down
2 changes: 1 addition & 1 deletion hypershift-operator/controllers/nodepool/aws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
hyperv1 "github.com/openshift/hypershift/api/v1beta1"
"k8s.io/apimachinery/pkg/api/equality"
k8sutilspointer "k8s.io/utils/pointer"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
)

const amiName = "ami"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import (
"k8s.io/client-go/tools/record"
"k8s.io/client-go/util/workqueue"
k8sutilspointer "k8s.io/utils/pointer"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiazure "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
capipowervs "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"k8s.io/apimachinery/pkg/types"
"k8s.io/apimachinery/pkg/util/intstr"
k8sutilspointer "k8s.io/utils/pointer"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/fake"
Expand Down
2 changes: 1 addition & 1 deletion support/api/scheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
apiserverconfigv1 "k8s.io/apiserver/pkg/apis/config/v1"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
apiregistrationv1 "k8s.io/kube-aggregator/pkg/apis/apiregistration/v1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiibm "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
capiv1 "sigs.k8s.io/cluster-api/api/v1beta1"
)
Expand Down
4 changes: 2 additions & 2 deletions support/upsert/upsert.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
apierrors "k8s.io/apimachinery/pkg/api/errors"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/sets"
capiawsv1beta1 "sigs.k8s.io/cluster-api-provider-aws/api/v1beta1"
capiaws "sigs.k8s.io/cluster-api-provider-aws/v2/api/v1beta2"
capiazure "sigs.k8s.io/cluster-api-provider-azure/api/v1beta1"
capiibmv1 "sigs.k8s.io/cluster-api-provider-ibmcloud/api/v1beta1"
capikubevirt "sigs.k8s.io/cluster-api-provider-kubevirt/api/v1alpha1"
Expand All @@ -32,7 +32,7 @@ type CreateOrUpdateProvider interface {
}

var withStatusSubresource = sets.NewString(
fmt.Sprintf("%T", &capiawsv1beta1.AWSCluster{}),
fmt.Sprintf("%T", &capiaws.AWSCluster{}),
fmt.Sprintf("%T", &configv1.ClusterOperator{}),
fmt.Sprintf("%T", &capikubevirt.KubevirtCluster{}),
fmt.Sprintf("%T", &capiv1.Cluster{}),
Expand Down

0 comments on commit 15a4f89

Please sign in to comment.