aws-quickstart / cdk-eks-blueprints

AWS Quick Start Team
Apache License 2.0
446 stars 198 forks source link

GenericClusterProvider autoscalingNodeGroups should support spot instance capicity #395

Closed vumdao closed 2 years ago

vumdao commented 2 years ago

Describe the feature

Describe the bug GenericClusterProvider autoscalingNodeGroups should support spot capacity. Currently it doesn't give the specify this capacity type

Expected Behavior Create a cluster using GenericClusterProvider with the following autoscalingNodeGroups attribute:

const asgClusterProvider = new AsgClusterProvider({
  version: KubernetesVersion.V1_21,
  id: 'dev-ASG',
  minSize: 1,
  maxSize: 2,
  desiredSize: 1,
  machineImageType: MachineImageType.BOTTLEROCKET,
  instanceType: new InstanceType('t3a.medium'),
  ASGCapacityType: eks.CapacityType.SPOT
});

Use Case

I want to use spot instance in GenericClusterProvider autoscalingNodeGroups for cost saving

Proposed Solution

No response

Other Information

No response

Acknowledgements

CDK version used

2.20.0

EKS Blueprints Version

2.20.0

Node.js Version

v16.13.0

Environment details (OS name and version, etc.)

Ubuntu

shapirov103 commented 2 years ago

@vumdao please check if #386 has the support that you need. This PR is already merged and I will publish shortly.

vumdao commented 2 years ago

@shapirov103 I just applied new release 1.0.1 and still don't find where to specify capacity type for ASG provider except spotInterruptHandler and spotPrice

shapirov103 commented 2 years ago

@vumdao My assumption was that combination of instanceType and spotPrice control this behavior. Please see more info here: https://aws-quickstart.github.io/cdk-eks-blueprints/api/interfaces/clusters.AutoscalingNodeGroup.html#spotPrice https://aws-quickstart.github.io/cdk-eks-blueprints/api/interfaces/clusters.AutoscalingNodeGroup.html#instanceType

This is the extent of current CDK support from what I observe. Current CDK support for EKS ASG: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_eks.AutoScalingGroupCapacityOptions.html

If my assumption is wrong, let's work together to come up with the right solution.