Skip to content

Commit

Permalink
support efa query (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
bwagner5 authored Aug 19, 2021
1 parent b6b7b2d commit 200b23d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ Filter Flags:
-a, --cpu-architecture string CPU architecture [x86_64/amd64, i386, or arm64]
--current-generation Current generation instance types (explicitly set this to false to not return current generation instance types)
--deny-list string List of instance types which should be excluded w/ regex syntax (Example: m[1-2]\.*)
--efa-support Instance types that support Elastic Fabric Adapters (EFA)
-e, --ena-support Instance types where ENA is supported or required
-f, --fpga-support FPGA instance types
--gpu-memory-total string Number of GPUs' total memory (Example: 4 GiB) (sets --gpu-memory-total-min and -max to the same value)
Expand Down
3 changes: 3 additions & 0 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ const (
usageClass = "usage-class"
rootDeviceType = "root-device-type"
enaSupport = "ena-support"
efaSupport = "efa-support"
hibernationSupport = "hibernation-support"
baremetal = "baremetal"
fpgaSupport = "fpga-support"
Expand Down Expand Up @@ -131,6 +132,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
cli.StringOptionsFlag(usageClass, cli.StringMe("u"), nil, "Usage class: [spot or on-demand]", []string{"spot", "on-demand"})
cli.StringOptionsFlag(rootDeviceType, nil, nil, "Supported root device types: [ebs or instance-store]", []string{"ebs", "instance-store"})
cli.BoolFlag(enaSupport, cli.StringMe("e"), nil, "Instance types where ENA is supported or required")
cli.BoolFlag(efaSupport, nil, nil, "Instance types that support Elastic Fabric Adapters (EFA)")
cli.BoolFlag(hibernationSupport, nil, nil, "Hibernation supported")
cli.BoolFlag(baremetal, nil, nil, "Bare Metal instance types (.metal instances)")
cli.BoolFlag(fpgaSupport, cli.StringMe("f"), nil, "FPGA instance types")
Expand Down Expand Up @@ -204,6 +206,7 @@ Full docs can be found at github.com/aws/amazon-` + binName
UsageClass: cli.StringMe(flags[usageClass]),
RootDeviceType: cli.StringMe(flags[rootDeviceType]),
EnaSupport: cli.BoolMe(flags[enaSupport]),
EfaSupport: cli.BoolMe(flags[efaSupport]),
HibernationSupported: cli.BoolMe(flags[hibernationSupport]),
Hypervisor: cli.StringMe(flags[hypervisor]),
BareMetal: cli.BoolMe(flags[baremetal]),
Expand Down
2 changes: 2 additions & 0 deletions pkg/selector/selector.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const (
burstable = "burstable"
fpga = "fpga"
enaSupport = "enaSupport"
efaSupport = "efaSupport"
vcpusToMemoryRatio = "vcpusToMemoryRatio"
currentGeneration = "currentGeneration"
networkInterfaces = "networkInterfaces"
Expand Down Expand Up @@ -223,6 +224,7 @@ func (itf Selector) rawFilter(filters Filters) ([]instancetypes.Details, error)
burstable: {filters.Burstable, instanceTypeInfo.BurstablePerformanceSupported},
fpga: {filters.Fpga, &isFpga},
enaSupport: {filters.EnaSupport, supportSyntaxToBool(instanceTypeInfo.NetworkInfo.EnaSupport)},
efaSupport: {filters.EfaSupport, instanceTypeInfo.NetworkInfo.EfaSupported},
vcpusToMemoryRatio: {filters.VCpusToMemoryRatio, calculateVCpusToMemoryRatio(instanceTypeInfo.VCpuInfo.DefaultVCpus, instanceTypeInfo.MemoryInfo.SizeInMiB)},
currentGeneration: {filters.CurrentGeneration, instanceTypeInfo.CurrentGeneration},
networkInterfaces: {filters.NetworkInterfaces, instanceTypeInfo.NetworkInfo.MaximumNetworkInterfaces},
Expand Down
3 changes: 3 additions & 0 deletions pkg/selector/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,9 @@ type Filters struct {
// EnaSupport returns instances that can support an Elastic Network Adapter.
EnaSupport *bool

// EfaSupport returns instances that can support an Elastic Fabric Adapter.
EfaSupport *bool

// FPGA is used to only return FPGA instance type results
Fpga *bool

Expand Down

0 comments on commit 200b23d

Please sign in to comment.