Skip to content

Commit 3462b4f

Browse files
Merge pull request openshift#207 from enxebre/revendor-drop-openshift-cluster
Revendor drop machine.openshift.io cluster
2 parents 4bd68c6 + 0ad3432 commit 3462b4f

File tree

39 files changed

+111
-966
lines changed

39 files changed

+111
-966
lines changed

Gopkg.lock

Lines changed: 5 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/aws-actuator/main.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ import (
4141

4242
"github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework"
4343
"github.com/openshift/cluster-api-actuator-pkg/pkg/manifests"
44+
clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
4445
machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
4546
machineactuator "sigs.k8s.io/cluster-api-provider-aws/pkg/actuators/machine"
4647
awsclient "sigs.k8s.io/cluster-api-provider-aws/pkg/client"
@@ -240,17 +241,17 @@ func bootstrapCommand() *cobra.Command {
240241
},
241242
}
242243

243-
testCluster := &machinev1.Cluster{
244+
testCluster := &clusterv1.Cluster{
244245
ObjectMeta: metav1.ObjectMeta{
245246
Name: machinePrefix,
246247
Namespace: testNamespace.Name,
247248
},
248-
Spec: machinev1.ClusterSpec{
249-
ClusterNetwork: machinev1.ClusterNetworkingConfig{
250-
Services: machinev1.NetworkRanges{
249+
Spec: clusterv1.ClusterSpec{
250+
ClusterNetwork: clusterv1.ClusterNetworkingConfig{
251+
Services: clusterv1.NetworkRanges{
251252
CIDRBlocks: []string{"10.0.0.1/24"},
252253
},
253-
Pods: machinev1.NetworkRanges{
254+
Pods: clusterv1.NetworkRanges{
254255
CIDRBlocks: []string{"10.0.0.1/24"},
255256
},
256257
ServiceDomain: "example.com",

cmd/aws-actuator/utils.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"sigs.k8s.io/controller-runtime/pkg/client/fake"
1818

1919
"github.com/openshift/cluster-api-actuator-pkg/pkg/e2e/framework"
20+
clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
2021
machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
2122
machineactuator "sigs.k8s.io/cluster-api-provider-aws/pkg/actuators/machine"
2223
"sigs.k8s.io/cluster-api-provider-aws/pkg/apis/awsproviderconfig/v1beta1"
@@ -51,13 +52,13 @@ func readMachineManifest(manifestParams *manifestParams, manifestLoc string) (*m
5152
return machine, nil
5253
}
5354

54-
func readClusterResources(manifestParams *manifestParams, clusterLoc, machineLoc, awsCredentialSecretLoc, userDataLoc string) (*machinev1.Cluster, *machinev1.Machine, *apiv1.Secret, *apiv1.Secret, error) {
55+
func readClusterResources(manifestParams *manifestParams, clusterLoc, machineLoc, awsCredentialSecretLoc, userDataLoc string) (*clusterv1.Cluster, *machinev1.Machine, *apiv1.Secret, *apiv1.Secret, error) {
5556
machine, err := readMachineManifest(manifestParams, machineLoc)
5657
if err != nil {
5758
return nil, nil, nil, nil, err
5859
}
5960

60-
cluster := &machinev1.Cluster{}
61+
cluster := &clusterv1.Cluster{}
6162
bytes, err := ioutil.ReadFile(clusterLoc)
6263
if err != nil {
6364
return nil, nil, nil, nil, fmt.Errorf("cluster manifest %q: %v", clusterLoc, err)

pkg/actuators/machine/actuator.go

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import (
3131
"k8s.io/client-go/tools/record"
3232
"k8s.io/klog"
3333

34+
clusterv1 "github.com/openshift/cluster-api/pkg/apis/cluster/v1alpha1"
3435
machinev1 "github.com/openshift/cluster-api/pkg/apis/machine/v1beta1"
3536
clustererror "github.com/openshift/cluster-api/pkg/controller/error"
3637
apierrors "github.com/openshift/cluster-api/pkg/errors"
@@ -104,7 +105,7 @@ func (a *Actuator) handleMachineError(machine *machinev1.Machine, err *apierrors
104105
}
105106

106107
// Create runs a new EC2 instance
107-
func (a *Actuator) Create(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error {
108+
func (a *Actuator) Create(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error {
108109
glog.Info("creating machine")
109110
instance, err := a.CreateMachine(cluster, machine)
110111
if err != nil {
@@ -175,7 +176,7 @@ func (a *Actuator) updateMachineProviderConditions(machine *machinev1.Machine, c
175176
}
176177

177178
// CreateMachine starts a new AWS instance as described by the cluster and machine resources
178-
func (a *Actuator) CreateMachine(cluster *machinev1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) {
179+
func (a *Actuator) CreateMachine(cluster *clusterv1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) {
179180
machineProviderConfig, err := providerConfigFromMachine(machine, a.codec)
180181
if err != nil {
181182
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.
239240
}
240241

241242
// Delete deletes a machine and updates its finalizer
242-
func (a *Actuator) Delete(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error {
243+
func (a *Actuator) Delete(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error {
243244
glog.Info("deleting machine")
244245
if err := a.DeleteMachine(cluster, machine); err != nil {
245246
glog.Errorf("error deleting machine: %v", err)
@@ -259,7 +260,7 @@ func (gl *glogLogger) Logf(format string, v ...interface{}) {
259260
}
260261

261262
// DeleteMachine deletes an AWS instance
262-
func (a *Actuator) DeleteMachine(cluster *machinev1.Cluster, machine *machinev1.Machine) error {
263+
func (a *Actuator) DeleteMachine(cluster *clusterv1.Cluster, machine *machinev1.Machine) error {
263264
machineProviderConfig, err := providerConfigFromMachine(machine, a.codec)
264265
if err != nil {
265266
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.
299300
// Update attempts to sync machine state with an existing instance. Today this just updates status
300301
// for details that may have changed. (IPs and hostnames) We do not currently support making any
301302
// changes to actual machines in AWS. Instead these will be replaced via MachineDeployments.
302-
func (a *Actuator) Update(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) error {
303+
func (a *Actuator) Update(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) error {
303304
glog.Info("updating machine")
304305

305306
machineProviderConfig, err := providerConfigFromMachine(machine, a.codec)
@@ -373,7 +374,7 @@ func (a *Actuator) Update(context context.Context, cluster *machinev1.Cluster, m
373374

374375
// Exists determines if the given machine currently exists. For AWS we query for instances in
375376
// running state, with a matching name tag, to determine a match.
376-
func (a *Actuator) Exists(context context.Context, cluster *machinev1.Cluster, machine *machinev1.Machine) (bool, error) {
377+
func (a *Actuator) Exists(context context.Context, cluster *clusterv1.Cluster, machine *machinev1.Machine) (bool, error) {
377378
glog.Info("Checking if machine exists")
378379

379380
instances, err := a.getMachineInstances(cluster, machine)
@@ -392,7 +393,7 @@ func (a *Actuator) Exists(context context.Context, cluster *machinev1.Cluster, m
392393
}
393394

394395
// Describe provides information about machine's instance(s)
395-
func (a *Actuator) Describe(cluster *machinev1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) {
396+
func (a *Actuator) Describe(cluster *clusterv1.Cluster, machine *machinev1.Machine) (*ec2.Instance, error) {
396397
glog.Infof("Checking if machine exists")
397398

398399
instances, err := a.getMachineInstances(cluster, machine)
@@ -408,7 +409,7 @@ func (a *Actuator) Describe(cluster *machinev1.Cluster, machine *machinev1.Machi
408409
return instances[0], nil
409410
}
410411

411-
func (a *Actuator) getMachineInstances(cluster *machinev1.Cluster, machine *machinev1.Machine) ([]*ec2.Instance, error) {
412+
func (a *Actuator) getMachineInstances(cluster *clusterv1.Cluster, machine *machinev1.Machine) ([]*ec2.Instance, error) {
412413
machineProviderConfig, err := providerConfigFromMachine(machine, a.codec)
413414
if err != nil {
414415
glog.Errorf("Error decoding MachineProviderConfig: %v", err)

0 commit comments

Comments
 (0)