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

feat(deadline): change SEP construct to use launch templates instead of launch specifications #513

Merged
merged 5 commits into from
Nov 22, 2021

Conversation

jericht
Copy link
Contributor

@jericht jericht commented Jul 27, 2021

Notes

Refactors the code around the Spot Event Plugin construct to use Launch Templates instead of Launch Specifications.

Testing

  • Updated unit tests
  • Deployed the SEP example app and verified SEP works as intended by:
    • Submitting jobs in Deadline to the configured SEP group
    • Verifying a new Spot Fleet Request was spun up using the Launch Template created by the SEP construct
  • Verified the SFRs created by SEP use the latest version of the Launch Template, without requiring a redeploy, by first rendering a job with SEP, terminating the old SEP instance, updating the Launch Template in the AWS console, then submitting a new job and ensured the Worker spun up used the new launch template version.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

@jericht jericht force-pushed the jericht/disable_imdsv1 branch 2 times, most recently from b350484 to 7323f60 Compare July 27, 2021 22:14
@jericht jericht marked this pull request as ready for review July 29, 2021 21:54
@jusiskin jusiskin added the contribution/core This is a PR that came from AWS. label Aug 2, 2021
Copy link

@gdday gdday left a comment

Choose a reason for hiding this comment

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

How feasible would it be to prevent tying the Spot Event Plugin to the Launch Template version that was created and, instead, using the latest version of the Launch Template?

That would let users edit the Launch Template in the AWS Console rather than making their changes in their CDK application.

@jericht
Copy link
Contributor Author

jericht commented Aug 9, 2021

@gdday So Spot does support using a special value $Latest for Launch Templates that would achieve this, however it looks like it's unfortunately not supported by CloudFormation:

The version number of the launch template. You must specify a version number. AWS CloudFormation does not support specifying $Latest or $Default for the template version number.

Maybe there's a way to do this with a custom resource that would update that value via calling the appropriate AWS APIs though, I'll look into seeing what that would look like

@gdday
Copy link

gdday commented Aug 9, 2021

Maybe there's a way to do this with a custom resource that would update that value via calling the appropriate AWS APIs though, I'll look into seeing what that would look like

Right, I think you could do it via the describe-launch-templates API in Lambda. I don't know how much additional work that would be, but I do think that would be useful for customers.

@jericht jericht changed the title feat: add ability to disable imdsv1 feat(deadline): change SEP construct to use launch templates instead of launch specifications Aug 16, 2021
@jericht jericht force-pushed the jericht/disable_imdsv1 branch 2 times, most recently from 37da9cd to 3b5a75a Compare August 16, 2021 21:23
@jericht jericht force-pushed the jericht/disable_imdsv1 branch 3 times, most recently from d11f144 to 91994f6 Compare August 24, 2021 18:50
gdday
gdday previously approved these changes Sep 2, 2021
Copy link

@gdday gdday left a comment

Choose a reason for hiding this comment

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

Thank you for adding support for $Latest. This will be very helpful for customers who want to quickly modify the Launch Template without having to redeploy.

This looks good to me, I don't see any issues!

@@ -522,51 +521,52 @@ export class ConfigureSpotEventPlugin extends Construct {
* Each congiguration is a mapping between one Deadline Group and one Spot Fleet Request Configuration.
Copy link

Choose a reason for hiding this comment

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

You didn't change this but... congiguration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nice catch, thanks! Fixed

Copy link
Contributor

@jusiskin jusiskin left a comment

Choose a reason for hiding this comment

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

This is great work, @jericht. The three primary concerns are:

  1. Move the launch template to be created in the SpotEvenPluginFleet if possible
  2. Make sure the required tags are added to launch templates for the Deadline Resource Tracker to function properly
  3. Map each SpotEventPluginFleet subnet to an individual LaunchTemplateConfig instead of passing an invalid comma-separated list of subnet IDs

Otherwise, there are a few minor semantic/polish suggestions.

@jericht
Copy link
Contributor Author

jericht commented Sep 9, 2021

@jusiskin @gdday I've retested this end-to-end and verified SEP is still working (as well as the Resource Tracker tags being applied to the spot instances). The CI build is failing because something is up with the CI runners that is causing an expected crash. I'll look into getting those fixed, but in the meantime this is ready for re-review

@jericht jericht force-pushed the jericht/disable_imdsv1 branch 3 times, most recently from eb195bc to 44be32e Compare November 1, 2021 23:57
Copy link
Contributor

@jusiskin jusiskin left a comment

Choose a reason for hiding this comment

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

Just a few minor suggestions here, but this is shaping up really nicely

@horsmand horsmand self-requested a review November 9, 2021 16:21
…of launch specifications

BREAKING CHANGE: SpotEventPluginFleet now uses EC2 Launch Templates instead of Launch Specifications.
See the [RFDK 0.39.x upgrade documentation](https://github.com/aws/aws-rfdk/blob/v0.39.0/packages/aws-rfdk/docs/upgrade/upgrading-0.39.md)
for more details and guidance on how to upgrade.
@jericht
Copy link
Contributor Author

jericht commented Nov 10, 2021

@horsmand @jusiskin I also changed the initial commit message to have a BREAKING CHANGE section and added some upgrade documentation since old SFRs will be orphaned if users try to redeploy while they have active SFRs that don't use launch templates.

I also did a final E2E test (deploy SEP example and render a cmd line job with SEP), so if everything looks good we can merge this in.

horsmand
horsmand previously approved these changes Nov 15, 2021
@horsmand
Copy link
Contributor

Is there any easy way to preview the diagram?

@jericht jericht force-pushed the jericht/disable_imdsv1 branch 3 times, most recently from 521fc2b to a8bd154 Compare November 15, 2021 22:30
@jericht
Copy link
Contributor Author

jericht commented Nov 15, 2021

Is there any easy way to preview the diagram?

@horsmand Yep, you can click the rich diff button in the top right of the file panel for the svg files

@jericht jericht force-pushed the jericht/disable_imdsv1 branch 3 times, most recently from e66ec42 to 37a8355 Compare November 15, 2021 23:47
Copy link
Contributor

@jusiskin jusiskin left a comment

Choose a reason for hiding this comment

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

Looks good to me! This will be a really great enhancement for RFDK users. Thanks for your hard work, @jericht

@jusiskin jusiskin added the pr/do-not-merge This PR should not be merged at this time. label Nov 16, 2021
@jericht jericht removed the pr/do-not-merge This PR should not be merged at this time. label Nov 22, 2021
@jericht jericht merged commit 7c61c18 into aws:mainline Nov 22, 2021
@jericht jericht deleted the jericht/disable_imdsv1 branch November 22, 2021 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contribution/core This is a PR that came from AWS.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants