-
Notifications
You must be signed in to change notification settings - Fork 53
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
Refactor AWS 2 #341
Refactor AWS 2 #341
Conversation
Codecov Report
@@ Coverage Diff @@
## dev #341 +/- ##
============================================
- Coverage 23.72% 23.62% -0.10%
- Complexity 545 546 +1
============================================
Files 172 175 +3
Lines 8998 9027 +29
Branches 1225 1224 -1
============================================
- Hits 2135 2133 -2
- Misses 6654 6686 +32
+ Partials 209 208 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With the package change it's really difficult to tell which lines of code are different in this PR review. Does it make sense to move these files back into the util folder for this PR and then submit a separate PR that just moves all of the files into the new package?
src/main/java/com/conveyal/datatools/common/utils/aws/IAMUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/S3Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/editor/jobs/ExportSnapshotToGTFSJob.java
Show resolved
Hide resolved
*/ | ||
@JsonIgnore | ||
@BsonIgnore | ||
public EC2ValidationResult validateEC2Config() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we move the EC2 config validation somewhere else? By moving it here, we're just ballooning this file (instead of ServerController
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe this is the best place for all of these validation utils. Every one of these validation methods is directly tied to an OtpServer instance.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
verifyS3WritePermissions
could be generalized and moved to S3Utils (doesn't need to be OtpServer specific).isEmpty
could be moved toUtils
or some othervalidateAmiId
,validateKeyName
,validateSecurityGroupId
could be generalized and moved to EC2Utils (where there are already some other validation methods)validateIamInstanceProfileArn
could be moved to IAMUtils
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved all of this in 5d3a85b
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has so many changes that I really can't be confident that everything will still work as expected (similarly to the previous PR). The fact that there are no accompanying tests does not give me much comfort. In general, I think it's best to not fix things unless they're broken. I know that some small things were broken with getting credentials, but I'm not sure if the scale of these PRs was really warranted.
Nevertheless, this looks like a good set of changes. Only a couple of comments about improving some very minor things.
For now, my method of "testing" is to try deploying something with a custom region and then deploying something that uses roles to get session credentials. If both of those complete successfully then I think it's good enough. It'd probably be a good idea to make some e2e tests or at least mock some of the AWS classes. With this refactor it might be easier to do that. Anyways, I'm reassigning as I believe I have addressed all other comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditional approval: The typos should be fixed IMO. The other code tweaks I mentioned are not blocking.
src/main/java/com/conveyal/datatools/common/utils/aws/AWSClientManager.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/EC2Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/EC2Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/EC2Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/EC2Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/IAMUtils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/common/utils/aws/S3Utils.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/manager/models/OtpServer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/manager/models/OtpServer.java
Outdated
Show resolved
Hide resolved
src/main/java/com/conveyal/datatools/manager/models/OtpServer.java
Outdated
Show resolved
Hide resolved
I like the split between EC2, S3, IAM etc. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. I had thought that some of the validation methods could be generalized so they could be used without an OtpServer, but that shouldn't be blocking (and could be handled if they're needed later in other contexts).
🎉 This PR is included in version 3.8.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Checklist
dev
before they can be merged tomaster
)Description
After looking through the first AWS refactor, it became clear that the AWSUtils class was becoming quite cluttered. Also, there were still a lot of methods in various classes that had logic that would be better placed elsewhere. Therefore, I moved a whole bunch of stuff around as follows:
common.util.aws
packageAWSUtils
class has been broken up into theEC2Utils
,IAMUtils
andS3Utils
classes.AWSClientManager
classServerController#terminateInstances
methods intoEC2Utils
ServerController
intoOtpServer
fetchEC2Instances
and one of thefetchEC2InstanceSummaries
methods fromDeploymentController
intoEC2Utils
FeedStore
bucket and prefix variables intoS3Utils
Also, the PR now fixes a bug so that role-based session credentials are properly refreshed.