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

aws-vpc-move-ip: Enable eni lookup for AWS shared networks via RAM #1549

Merged
merged 2 commits into from Sep 1, 2020

Conversation

sbotman
Copy link
Contributor

@sbotman sbotman commented Aug 27, 2020

In a shared network pattern where the cluster resides in shared subnets the instance ids of the nodes are not retrievable but the eni ids are and this optional feature gives transparent support in that situation.

@knet-ci-bot
Copy link

Can one of the admins verify this patch?

heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
@oalbrigt
Copy link
Contributor

I've added a couple of suggestions to improve patch.

Can you also prefix the commits with "aws-vpc-move-ip:" so it's easy to see which agent they change from git log?

@sbotman sbotman changed the title Enable eni lookup for AWS shared networks via RAM aws-vpc-move-ip: Enable eni lookup for AWS shared networks via RAM Aug 27, 2020
@gguifelixamz
Copy link
Contributor

gguifelixamz commented Aug 27, 2020

Hello,

While I find the changes interesting, I would like to know if all test cases are being considered and we're still fully backward compatible with all features this agent provides. Some examples:

  • Single ENI
  • Multiple ENIs
  • Single Routing Table
  • Multiple Routing Tables

Can you also provide some usage guide on the new parameters in this PR for documentation purposes?

@sbotman
Copy link
Contributor Author

sbotman commented Aug 27, 2020

Hello,

I understand your concerns but this logic didn't change, so single or multiple tables are working fine.
While describing the route tables, it returns the instance-id and the network-interface-id, so you have both by default.

Only when you have 1 AWS account (call it the network account) containing all VPC's and sharing these networks via RAM (resource access manager) to another accounts containing the workloads (EC2 instances) then you don't get the instance-id information. This is because you need to check the route-table by assuming the role in the network account and check the table there, but because the workload is not part of this account, you lose this information.

You do get the network-interface-id information, so by setting the lookup_type=NetworkInterfaceId on the resource creation, you can do the matching on network-interface-id. By default the option is InstanceId.

Hope this covers the documentation part.
Sander

@gguifelixamz
Copy link
Contributor

Thank you Sander, I think that cover all the questions I had! :-)

heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
heartbeat/aws-vpc-move-ip Outdated Show resolved Hide resolved
@nrwahl2
Copy link
Contributor

nrwahl2 commented Aug 28, 2020

The final product all looks good to me.

Since this PR isn't merged yet, we don't need separate commits to fix mistakes that were made while developing this PR. I think a total of two commits makes the most sense:

  • aws-vpc-move-ip: Implemented optional eni lookup instead of the defau…
  • aws-vpc-move-ip: Fix region option

The other five current commits should be part of an edited "Implemented optional eni lookup" commit.

Can you squash all the commits (except for the region fix commit, which should be separate) into the original commit? I think you can do that in an interactive git-rebase by moving the region commit to the end of the history and then changing "pick" to "fixup" for all the fix commits, and then doing a force-push.

costastf and others added 2 commits August 28, 2020 22:33
…lt instance id.

In a shared network pattern where the cluster resides in shared subnets the instance ids of the nodes are not retrievable but the eni ids are and this optional feature gives transparent support in that situation.
@sbotman
Copy link
Contributor Author

sbotman commented Aug 28, 2020

Tnx @nrwahl2 for all the reviews!
Really appreciate all the feedback and support getting this forward!

@nrwahl2
Copy link
Contributor

nrwahl2 commented Aug 28, 2020

@oalbrigt If you have any concerns about the overall approach (or you run it by anyone else who does), let us know. As I mentioned in one of the review comments, I don't have the cycles to research exactly what this feature is doing and test it out right now.

Also need to get f4c8daa into RHBZ#1872999. I misread and thought the execute_cmd_as_role() function was already appending the region opt, but it isn't, so we do need this commit from Sander.

@sbotman
Copy link
Contributor Author

sbotman commented Aug 29, 2020

I have tested the final script and ran into an interesting use case.

Once you specify that you want to assume a role, the execute_cmd_as_role() function is executed.
Here the --profile default (or other profile name if specified) is used.
Now if you don't have any ~/.aws/config file with an [default] section in there, the command will error out with: The config profile (default) could not be found and the assume role will not execute.

So I think the --profile option should become optional and only added if set.
This will brake backwards compatibility for sure, so didn't change this but I do wanted to mention this here.

Otherwise the script is working fine for me.
Kind Regards,
Sander Botman

@oalbrigt
Copy link
Contributor

oalbrigt commented Sep 1, 2020

Right. The parameter is optional (see metadata), so it sounds like that's a mistake in the initial code.

I guess you could update the profile parameter to --profile $OCF... when it is set and remove --profile from where it's used in the code.

@sbotman
Copy link
Contributor Author

sbotman commented Sep 1, 2020

Since it's not really related to this change, shall we move that into another request?
Because that change could start another long discussion :)

@oalbrigt
Copy link
Contributor

oalbrigt commented Sep 1, 2020

Sure :)

@oalbrigt
Copy link
Contributor

oalbrigt commented Sep 1, 2020

ok to test

@oalbrigt
Copy link
Contributor

oalbrigt commented Sep 1, 2020

LGTM. Thanks.

@oalbrigt oalbrigt merged commit 104bb45 into ClusterLabs:master Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants