Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revendor drop machine.openshift.io cluster #207

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions cmd/aws-actuator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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",
Expand Down
5 changes: 3 additions & 2 deletions cmd/aws-actuator/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down
17 changes: 9 additions & 8 deletions pkg/actuators/machine/actuator.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
Loading