Skip to content
Snippets Groups Projects
Commit 38385069 authored by Axel von Bertoldi's avatar Axel von Bertoldi
Browse files

Merge branch 'amazonec2-credit-specification' into 'main'

parents 145bd24f 44911090
No related branches found
No related tags found
No related merge requests found
......@@ -74,6 +74,7 @@ You can use environment variables:
- `--amazonec2-use-ebs-optimized-instance`: Create an EBS Optimized Instance, instance type must support it.
- `--amazonec2-ssh-keypath`: Path to Private Key file to use for instance. Matching public key with .pub extension should exist
- `--amazonec2-retries`: Set retry count for recoverable failures (use -1 to disable)
- `--amazonec2-credit-specification`: The credit option for CPU usage of the instance. Valid values: `standard`, `unlimited`. Defaults to [what AWS sets for the instance type](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances-unlimited-mode.html). Only supported on [burstable instance types](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/burstable-performance-instances.html#burstable-instance-types)
#### Environment variables and default values:
......@@ -106,6 +107,7 @@ You can use environment variables:
| `--amazonec2-use-ebs-optimized-instance` | - | `false` |
| `--amazonec2-ssh-keypath` | `AWS_SSH_KEYPATH` | - |
| `--amazonec2-retries` | - | `5` |
| `--amazonec2-credit-specification` | - | - |
## Default AMIs
......
......@@ -118,6 +118,7 @@ type Driver struct {
UserDataFile string
MetadataTokenSetting string
MetadataTokenResponseHopLimit int64
CreditSpecification string
}
type clientFactory interface {
......@@ -309,6 +310,10 @@ func (d *Driver) GetCreateFlags() []mcnflag.Flag {
Usage: "The number of network hops that the metadata token can travel",
Value: defaultMetadataTokenResponseHopLimit,
},
mcnflag.StringFlag{
Name: "amazonec2-credit-specification",
Usage: "The credit option for CPU usage (unlimited or standard)",
},
}
}
......@@ -414,6 +419,7 @@ func (d *Driver) SetConfigFromFlags(flags drivers.DriverOptions) error {
d.MetadataTokenSetting = flags.String("amazonec2-metadata-token")
d.MetadataTokenResponseHopLimit = int64(flags.Int("amazonec2-metadata-token-response-hop-limit"))
d.DisableSSL = flags.Bool("amazonec2-insecure-transport")
d.CreditSpecification = strings.TrimSpace(flags.String("amazonec2-credit-specification"))
if d.DisableSSL && d.Endpoint == "" {
return errorDisableSSLWithoutCustomEndpoint
......@@ -696,6 +702,11 @@ func (d *Driver) innerCreate() error {
BlockDeviceMappings: []*ec2.BlockDeviceMapping{bdm},
UserData: &userdata,
}
if d.CreditSpecification != "" {
req.CreditSpecification = &ec2.CreditSpecificationRequest{
CpuCredits: &d.CreditSpecification,
}
}
if d.RequestSpotInstance {
req.InstanceMarketOptions = &ec2.InstanceMarketOptionsRequest{
MarketType: aws.String("spot"),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment