Skip to content

Sync with cluster operator implementation - #2

Merged
ingvagabund merged 2 commits into
openshift:masterfrom
ingvagabund:sync-cluster-operator-aws-actuator
Aug 15, 2018
Merged

ingvagabund merged 2 commits into
openshift:masterfrom
ingvagabund:sync-cluster-operator-aws-actuator

Conversation

@ingvagabund

@ingvagabund ingvagabund commented Aug 4, 2018 •

Copy link
Copy Markdown
Member

Syncing the aws machine actuator implementation + providing simple unit test for the machine actuator.

Both AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY envs need to be set.

TODO

  • sync the latest aws actuator implementation of the cluster-operator
  • remove all imports of the cluster-operator packages
  • remove any reference of the openshift keyword
  • sync the provider config types with the upstream proposal
  • remove the machine set part
  • use mocked aws client in the unit-test
  • create integration test that will verify the aws actuator creates a real instances in the aws cloud

Follow up PR

  • - support AMI lookup for Filter and ARN as well
  • - update the status loop to actually update the machine status based on the real instance state (e.g. if it's either running or still in pending state, public IPs assigned if set, etc.)

@ingvagabund

Copy link
Copy Markdown
Member Author

@spangenberg FYI

@dgoodwin

dgoodwin commented Aug 7, 2018

Copy link
Copy Markdown

@ingvagabund are any of the open tasks above something I can help out with and send you a PR to your branch?

@ingvagabund

Copy link
Copy Markdown
Member Author

@dgoodwin I moved all the openshift specific pieces into machine manifest (e.g. into tags, labels, secrets). Feel free to review the PR.

@ingvagabund

Copy link
Copy Markdown
Member Author

@csrwng PTAL we can iterate on the implementation later in case there are still some missing pieces (e.g. in case the way the user data are provided is not powerful enough).

@csrwng csrwng left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start. Some comments.

Comment thread cmd/machine-controller/main.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Openstack/AWS/

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't look like this is used anywhere

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kept from the original template. We will need to populate it later (at least for testing purposes).

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not LocalObjectReference?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/string/LocalObjectReference/ done

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should be of type AWSResourceReference

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe rename to awsClientBuilder? It's not clear just looking at this what client it's supposed to build

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done as part of introducing the fake aws client.

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should now obey the security groups specified in the machine provider config, instead of assuming what they are based on the machine type.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This value should be based on machineProviderConfig.PublicIP

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this mean? Seems like you'd want all tags except for the last one (Name)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy-paste from the cluster-operator :P This actually takes takes slice that contains only the first item: https://play.golang.org/p/RKFZnCF3GaB. I have changed that part to provide the list of tags directly.

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Part of the status that gets updated when the machine gets created is the PublicIP. However, after a call to runInstance, most of the time a PublicIP is not yet allocated. If we don't yet have complete status (ie. the instance state is Pending, instead of Running), maybe we should return an error so the machine controller keeps retrying until we have complete status we can set.

@ingvagabund ingvagabund Aug 14, 2018 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's track that in the follow-up PR. This will need slight re-desigin as you described in the comment above. Put TODO comment in the code.

Comment thread cloud/aws/actuators/machine/actuator.go Outdated

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One issue we have right now with how this works, is that usually at the end of the RunInstances call, the instance state is not yet 'Running'. Rather it is 'Pending'. Therefore the status is not yet complete (like PublicIP). One possible fix would be to wait and poll here until the instance is in the Running state. The other approach is to return an error so that the machine is requeued and in the exists function return false if the status doesn't match. That would require making the create re-entrant so we can just update the status.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put TODO comment in the code.

@ingvagabund ingvagabund changed the title WIP: Sync with cluster operator implementation Sync with cluster operator implementation Aug 14, 2018
@ingvagabund

Copy link
Copy Markdown
Member Author

@enxebre @csrwng ready for review, I moved the "real" part of the unit-test into integration test under test/integration. The goal of the PR is to provide an aws actuator implementation we can build on top of. There are still a lot of to do but that can wait until the next PR.

@csrwng

csrwng commented Aug 14, 2018

Copy link
Copy Markdown

/lgtm

@openshift-ci-robot

Copy link
Copy Markdown

@csrwng: changing LGTM is restricted to assignees, and assigning you to the PR failed.

Details

In response to this:

/lgtm

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@ingvagabund ingvagabund added the lgtm Indicates that a PR is ready to be merged. label Aug 15, 2018
@ingvagabund

Copy link
Copy Markdown
Member Author

/assign csrwng enxebre

@ingvagabund

Copy link
Copy Markdown
Member Author

Tested and verified corresponding AWS instance gets created, resp. deleted when a machine manifest is applied, resp. deleted.

@ingvagabund
ingvagabund merged commit 4ab5b7f into openshift:master Aug 15, 2018
@ingvagabund
ingvagabund deleted the sync-cluster-operator-aws-actuator branch August 15, 2018 13:15
wking added a commit to wking/cluster-api-provider-aws that referenced this pull request Nov 14, 2019
…tances

getInstances has taken an instanceStateFilter argument since it landed
as GetInstances in 72b4823 (Migrate cluster operator implementation
of the aws actuator, 2018-08-04,
openshift#2).
enxebre pushed a commit to enxebre/cluster-api-provider-aws-2 that referenced this pull request Feb 20, 2020
…tances

getInstances has taken an instanceStateFilter argument since it landed
as GetInstances in 72b4823 (Migrate cluster operator implementation
of the aws actuator, 2018-08-04,
openshift#2).
openshift-cherrypick-robot pushed a commit to openshift-cherrypick-robot/cluster-api-provider-aws that referenced this pull request Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm Indicates that a PR is ready to be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants