From 90b0ae5e4f10e70854f290448e4a477b3b52a934 Mon Sep 17 00:00:00 2001 From: Enxebre Date: Tue, 30 Apr 2019 12:48:54 +0200 Subject: [PATCH] Reference cluster from cluster.k8s.io --- cmd/aws-actuator/main.go | 11 +-- cmd/aws-actuator/utils.go | 5 +- pkg/actuators/machine/actuator.go | 17 ++--- pkg/actuators/machine/actuator_test.go | 69 ++++++++++--------- pkg/actuators/machine/stubs.go | 5 +- test/integration/create_update_delete_test.go | 5 +- test/machines/machines_test.go | 14 ++-- 7 files changed, 66 insertions(+), 60 deletions(-) diff --git a/cmd/aws-actuator/main.go b/cmd/aws-actuator/main.go index 8c89effdd4..bf23738314 100644 --- a/cmd/aws-actuator/main.go +++ b/cmd/aws-actuator/main.go @@ -41,6 +41,7 @@ import ( "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework" "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" machineactuator "sigs.k8s.io/cluster-api-provider-aws/pkg/actuators/machine" awsclient "sigs.k8s.io/cluster-api-provider-aws/pkg/client" @@ -240,17 +241,17 @@ func bootstrapCommand() *cobra.Command { }, } - testCluster := &machinev1.Cluster{ + testCluster := &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: machinePrefix, Namespace: testNamespace.Name, }, - Spec: machinev1.ClusterSpec{ - ClusterNetwork: machinev1.ClusterNetworkingConfig{ - Services: machinev1.NetworkRanges{ + Spec: clusterv1.ClusterSpec{ + ClusterNetwork: clusterv1.ClusterNetworkingConfig{ + Services: clusterv1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, - Pods: machinev1.NetworkRanges{ + Pods: clusterv1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, ServiceDomain: "example.com", diff --git a/cmd/aws-actuator/utils.go b/cmd/aws-actuator/utils.go index 9f1ba7ac63..4612d63266 100644 --- a/cmd/aws-actuator/utils.go +++ b/cmd/aws-actuator/utils.go @@ -17,6 +17,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client/fake" "github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" machineactuator "sigs.k8s.io/cluster-api-provider-aws/pkg/actuators/machine" "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1" @@ -51,13 +52,13 @@ func readMachineManifest(manifestParams *manifestParams, manifestLoc string) (*m return machine, nil } -func readClusterResources(manifestParams *manifestParams, clusterLoc, machineLoc, awsCredentialSecretLoc, userDataLoc string) (*machinev1.Cluster, *machinev1.Machine, *apiv1.Secret, *apiv1.Secret, error) { +func readClusterResources(manifestParams *manifestParams, clusterLoc, machineLoc, awsCredentialSecretLoc, userDataLoc string) (*clusterv1.Cluster, *machinev1.Machine, *apiv1.Secret, *apiv1.Secret, error) { machine, err := readMachineManifest(manifestParams, machineLoc) if err != nil { return nil, nil, nil, nil, err } - cluster := &machinev1.Cluster{} + cluster := &clusterv1.Cluster{} bytes, err := ioutil.ReadFile(clusterLoc) if err != nil { return nil, nil, nil, nil, fmt.Errorf("cluster manifest %q: %v", clusterLoc, err) diff --git a/pkg/actuators/machine/actuator.go b/pkg/actuators/machine/actuator.go index 150cf666fc..953878e876 100644 --- a/pkg/actuators/machine/actuator.go +++ b/pkg/actuators/machine/actuator.go @@ -31,6 +31,7 @@ import ( "k8s.io/client-go/tools/record" "k8s.io/klog" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" clustererror "github.com/openshift/cluster-api/pkg/controller/error" apierrors "github.com/openshift/cluster-api/pkg/errors" @@ -104,7 +105,7 @@ func (a *Actuator) handleMachineError(machine *machinev1.Machine, err *apierrors } // Create runs a new EC2 instance -func (a *Actuator) Create(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { +func (a *Actuator) Create(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { glog.Info("creating machine") instance, err := a.CreateMachine(cluster, machine) if err != nil { @@ -175,7 +176,7 @@ func (a *Actuator) updateMachineProviderConditions(machine *machinev1.Machine, c } // CreateMachine starts a new AWS instance as described by the cluster and machine resources -func (a *Actuator) CreateMachine(cluster *machinev1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) { +func (a *Actuator) CreateMachine(cluster *clusterv1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) { machineProviderConfig, err := providerConfigFromMachine(machine, a.codec) if err != nil { return nil, a.handleMachineError(machine, apierrors.InvalidMachineConfiguration("error decoding MachineProviderConfig: %v", err), createEventAction) @@ -239,7 +240,7 @@ func (a *Actuator) CreateMachine(cluster *machinev1.Cluster, machine *machinev1. } // Delete deletes a machine and updates its finalizer -func (a *Actuator) Delete(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { +func (a *Actuator) Delete(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { glog.Info("deleting machine") if err := a.DeleteMachine(cluster, machine); err != nil { glog.Errorf("error deleting machine: %v", err) @@ -259,7 +260,7 @@ func (gl *glogLogger) Logf(format string, v ...interface{}) { } // DeleteMachine deletes an AWS instance -func (a *Actuator) DeleteMachine(cluster *machinev1.Cluster, machine *machinev1.Machine) error { +func (a *Actuator) DeleteMachine(cluster *clusterv1.Cluster, machine *machinev1.Machine) error { machineProviderConfig, err := providerConfigFromMachine(machine, a.codec) if err != nil { return a.handleMachineError(machine, apierrors.InvalidMachineConfiguration("error decoding MachineProviderConfig: %v", err), deleteEventAction) @@ -299,7 +300,7 @@ func (a *Actuator) DeleteMachine(cluster *machinev1.Cluster, machine *machinev1. // Update attempts to sync machine state with an existing instance. Today this just updates status // for details that may have changed. (IPs and hostnames) We do not currently support making any // changes to actual machines in AWS. Instead these will be replaced via MachineDeployments. -func (a *Actuator) Update(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error { +func (a *Actuator) Update(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error { glog.Info("updating machine") machineProviderConfig, err := providerConfigFromMachine(machine, a.codec) @@ -373,7 +374,7 @@ func (a *Actuator) Update(context context.Context, cluster *machinev1.Cluster, m // Exists determines if the given machine currently exists. For AWS we query for instances in // running state, with a matching name tag, to determine a match. -func (a *Actuator) Exists(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) (bool, error) { +func (a *Actuator) Exists(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) (bool, error) { glog.Info("Checking if machine exists") instances, err := a.getMachineInstances(cluster, machine) @@ -392,7 +393,7 @@ func (a *Actuator) Exists(context context.Context, cluster *machinev1.Cluster, m } // Describe provides information about machine's instance(s) -func (a *Actuator) Describe(cluster *machinev1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) { +func (a *Actuator) Describe(cluster *clusterv1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) { glog.Infof("Checking if machine exists") instances, err := a.getMachineInstances(cluster, machine) @@ -408,7 +409,7 @@ func (a *Actuator) Describe(cluster *machinev1.Cluster, machine *machinev1.Machi return instances[0], nil } -func (a *Actuator) getMachineInstances(cluster *machinev1.Cluster, machine *machinev1.Machine) ([]*ec2.Instance, error) { +func (a *Actuator) getMachineInstances(cluster *clusterv1.Cluster, machine *machinev1.Machine) ([]*ec2.Instance, error) { machineProviderConfig, err := providerConfigFromMachine(machine, a.codec) if err != nil { glog.Errorf("Error decoding MachineProviderConfig: %v", err) diff --git a/pkg/actuators/machine/actuator_test.go b/pkg/actuators/machine/actuator_test.go index 1bd21d714a..3bcb95d719 100644 --- a/pkg/actuators/machine/actuator_test.go +++ b/pkg/actuators/machine/actuator_test.go @@ -13,6 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" providerconfigv1 "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1" awsclient "sigs.k8s.io/cluster-api-provider-aws/pkg/client" @@ -61,7 +62,7 @@ func TestMachineEvents(t *testing.T) { name string machine *machinev1.Machine error string - operation func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) + operation func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) event string describeInstancesOutput *ec2.DescribeInstancesOutput describeInstancesErr error @@ -73,7 +74,7 @@ func TestMachineEvents(t *testing.T) { { name: "Create machine event failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Warning FailedCreate InvalidConfiguration", @@ -82,7 +83,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error creating aws service)", machine: machine, error: awsServiceError, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -91,7 +92,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error launching instance)", machine: machine, runInstancesErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -100,7 +101,7 @@ func TestMachineEvents(t *testing.T) { name: "Create machine event failed (error updating load balancers)", machine: machine, lbErr: fmt.Errorf("error"), - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Warning FailedCreate CreateError", @@ -108,7 +109,7 @@ func TestMachineEvents(t *testing.T) { { name: "Create machine event succeed", machine: machine, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Normal Created Created Machine aws-actuator-testing-machine", @@ -116,7 +117,7 @@ func TestMachineEvents(t *testing.T) { { name: "Create worker machine event succeed", machine: workerMachine, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.CreateMachine(cluster, machine) }, event: "Normal Created Created Machine aws-actuator-testing-machine", @@ -124,7 +125,7 @@ func TestMachineEvents(t *testing.T) { { name: "Delete machine event failed", machine: machineInvalidProviderConfig, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.DeleteMachine(cluster, machine) }, event: "Warning FailedDelete InvalidConfiguration", @@ -132,7 +133,7 @@ func TestMachineEvents(t *testing.T) { { name: "Delete machine event succeed", machine: machine, - operation: func(actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.DeleteMachine(cluster, machine) }, event: "Normal Deleted Deleted machine aws-actuator-testing-machine", @@ -244,7 +245,7 @@ func TestActuator(t *testing.T) { name string machine *machinev1.Machine error string - operation func(client client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) + operation func(client client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) describeInstancesOutput *ec2.DescribeInstancesOutput runInstancesErr error describeInstancesErr error @@ -254,7 +255,7 @@ func TestActuator(t *testing.T) { { name: "Create machine with success", machine: machine, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { createErr := actuator.Create(context.TODO(), cluster, machine) assert.NoError(t, createErr) @@ -294,7 +295,7 @@ func TestActuator(t *testing.T) { name: "Create machine with failure", machine: machine, runInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { createErr := actuator.Create(context.TODO(), cluster, machine) assert.Error(t, createErr) @@ -309,28 +310,28 @@ func TestActuator(t *testing.T) { { name: "Update machine with success", machine: machine, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Update machine failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Update machine failed (error creating aws service)", error: awsServiceError, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Update machine failed (error getting running instances)", describeInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, @@ -343,7 +344,7 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, @@ -359,7 +360,7 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, @@ -374,7 +375,7 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, @@ -391,42 +392,42 @@ func TestActuator(t *testing.T) { }, }, terminateInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Update machine with failure (cluster ID missing)", machine: machineNoClusterID, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Update machine failed (error updating load balancers)", lbErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Update(context.TODO(), cluster, machine) }, }, { name: "Describe machine fails (error getting running instance)", describeInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Describe(cluster, machine) }, }, { name: "Describe machine failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Describe(cluster, machine) }, }, { name: "Describe machine failed (error creating aws service)", error: awsServiceError, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Describe(cluster, machine) }, }, @@ -439,20 +440,20 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Describe(cluster, machine) }, }, { name: "Describe machine succeeds", - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Describe(cluster, machine) }, }, { name: "Exists machine failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Exists(context.TODO(), cluster, machine) }, }, @@ -465,28 +466,28 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Exists(context.TODO(), cluster, machine) }, }, { name: "Delete machine failed (invalid configuration)", machine: machineInvalidProviderConfig, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, }, { name: "Delete machine failed (error creating aws service)", error: awsServiceError, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, }, { name: "Delete machine failed (error getting running instances)", describeInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, }, @@ -499,14 +500,14 @@ func TestActuator(t *testing.T) { }, }, }, - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, }, { name: "Delete machine failed (error terminating instances)", terminateInstancesErr: fmt.Errorf("error"), - operation: func(objectClient client.Client, actuator *Actuator, cluster *machinev1.Cluster, machine *machinev1.Machine) { + operation: func(objectClient client.Client, actuator *Actuator, cluster *clusterv1.Cluster, machine *machinev1.Machine) { actuator.Delete(context.TODO(), cluster, machine) }, }, diff --git a/pkg/actuators/machine/stubs.go b/pkg/actuators/machine/stubs.go index a8f6cc27fa..be56557031 100644 --- a/pkg/actuators/machine/stubs.go +++ b/pkg/actuators/machine/stubs.go @@ -12,6 +12,7 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" machinecontroller "github.com/openshift/cluster-api/pkg/controller/machine" providerconfigv1 "sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1" @@ -136,8 +137,8 @@ func stubMachine() (*machinev1.Machine, error) { return machine, nil } -func stubCluster() *machinev1.Cluster { - return &machinev1.Cluster{ +func stubCluster() *clusterv1.Cluster { + return &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: defaultNamespace, diff --git a/test/integration/create_update_delete_test.go b/test/integration/create_update_delete_test.go index 0aab914587..1aa0ee0cfe 100644 --- a/test/integration/create_update_delete_test.go +++ b/test/integration/create_update_delete_test.go @@ -14,6 +14,7 @@ import ( apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" machineactuator "sigs.k8s.io/cluster-api-provider-aws/pkg/actuators/machine" awsclient "sigs.k8s.io/cluster-api-provider-aws/pkg/client" @@ -43,7 +44,7 @@ runcmd: - [ cat, /root/node_bootstrap/node_settings.yaml] ` -func testMachineAPIResources(clusterID string) (*machinev1.Machine, *machinev1.Cluster, *apiv1.Secret, *apiv1.Secret, error) { +func testMachineAPIResources(clusterID string) (*machinev1.Machine, *clusterv1.Cluster, *apiv1.Secret, *apiv1.Secret, error) { machine := &machinev1.Machine{} bytes, err := ioutil.ReadFile(path.Join(os.Getenv("GOPATH"), "/src/sigs.k8s.io/cluster-api-provider-aws/examples/machine.yaml")) @@ -76,7 +77,7 @@ func testMachineAPIResources(clusterID string) (*machinev1.Machine, *machinev1.C }, } - cluster := &machinev1.Cluster{ + cluster := &clusterv1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: defaultNamespace, diff --git a/test/machines/machines_test.go b/test/machines/machines_test.go index 7591957a7b..69db120f56 100644 --- a/test/machines/machines_test.go +++ b/test/machines/machines_test.go @@ -17,7 +17,7 @@ import ( "github.com/openshift/cluster-api-actuator-pkg/pkg/manifests" "sigs.k8s.io/cluster-api-provider-aws/test/utils" - MachineV1beta1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1" + ClusterV1alpha1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1" machinecontroller "github.com/openshift/cluster-api/pkg/controller/machine" apiv1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -89,7 +89,7 @@ var _ = framework.SigKubeDescribe("Machines", func() { acw *machineutils.AwsClientWrapper awsClient awsclient.Client awsCredSecret *apiv1.Secret - cluster *MachineV1beta1.Cluster + cluster *ClusterV1alpha1.Cluster clusterID string ) @@ -102,17 +102,17 @@ var _ = framework.SigKubeDescribe("Machines", func() { clusterID = "cluster-" + string(uuid.NewUUID()) } - cluster = &MachineV1beta1.Cluster{ + cluster = &ClusterV1alpha1.Cluster{ ObjectMeta: metav1.ObjectMeta{ Name: clusterID, Namespace: testNamespace.Name, }, - Spec: MachineV1beta1.ClusterSpec{ - ClusterNetwork: MachineV1beta1.ClusterNetworkingConfig{ - Services: MachineV1beta1.NetworkRanges{ + Spec: ClusterV1alpha1.ClusterSpec{ + ClusterNetwork: ClusterV1alpha1.ClusterNetworkingConfig{ + Services: ClusterV1alpha1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, - Pods: MachineV1beta1.NetworkRanges{ + Pods: ClusterV1alpha1.NetworkRanges{ CIDRBlocks: []string{"10.0.0.1/24"}, }, ServiceDomain: "example.com",