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

Add Services Support for EKS and EMR #72

Merged
merged 7 commits into from
Feb 3, 2021
Merged

Conversation

bwagner5
Copy link
Contributor

Issue #, if available:
#68

Description of changes:

TL;DR:

This PR adds support for arbitrary service filtering based on a simple service interface which transforms the user supplied filters (just like the aggregate filter functionality). This PR adds two implementations of services for EMR and EKS w/ versioning.

Example CLI usage:

$ ec2-instance-selector --service eks --max-results 5
a1.2xlarge
a1.4xlarge
a1.large
a1.medium
a1.metal
NOTE: 374 entries were truncated, increase --max-results to see more

$ ec2-instance-selector --service eks-20210125 --max-results 5
a1.2xlarge
a1.4xlarge
a1.large
a1.medium
a1.metal
NOTE: 374 entries were truncated, increase --max-results to see more

$ ec2-instance-selector --service emr --max-results 5
c1.medium
c1.xlarge
c3.2xlarge
c3.4xlarge
c3.8xlarge
NOTE: 191 entries were truncated, increase --max-results to see more

$ ec2-instance-selector --service emr-5.25.0 --max-results 5
c1.medium
c1.xlarge
c3.2xlarge
c3.4xlarge
c3.8xlarge
NOTE: 197 entries were truncated, increase --max-results to see more

Details:

  • InstanceTypes was added as a Filter so that service filters can start with a universal set of instance types without restricting a user's use of the allow-list.
  • VirtType was added as a filter since emr and eks both only support hvm instance types

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

pkg/selector/eks.go Show resolved Hide resolved
pkg/selector/emr.go Outdated Show resolved Hide resolved
pkg/selector/emr.go Show resolved Hide resolved
pkg/selector/emr.go Show resolved Hide resolved
}

func (EMR) getAllEMRInstanceTypes() []string {
return []string{
Copy link
Contributor

Choose a reason for hiding this comment

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

how often will this need to be updated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure.... This is definitely not an optimal solution, but I think it'll be the best hack available. Other downsides are that users will have to actually update the ec2-instance-selector binary to get updated versions or to add supported instance types to older versions.

Copy link
Contributor

Choose a reason for hiding this comment

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

Gotcha, if we see ourselves needing to manually update this list often then we could look into watching and/or pulling directly from the github readme on emr types

pkg/selector/services_test.go Outdated Show resolved Hide resolved
cmd/main.go Show resolved Hide resolved
if version == "" {
version = fallbackVersion
}
semanticVersion, err := semver.Make(version)
Copy link
Contributor

Choose a reason for hiding this comment

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

oo nice 🤩

Copy link
Contributor

@brycahta brycahta left a comment

Choose a reason for hiding this comment

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

Looks great! 👍

@rothgar
Copy link

rothgar commented Feb 2, 2021

Looks great! I was able to combine --service eks with -o one-line for what I needed with eksctl 👍

@bwagner5 bwagner5 merged commit 23f8487 into aws:main Feb 3, 2021
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

3 participants