karpenter-provider-aws
karpenter-provider-aws copied to clipboard
feat: Dynamic EBS `volumeSize` in `EC2NodeClass`
Fixes #8023
Summary:
This pull request enhances the EC2NodeClass functionality by allowing the volumeSize field to be dynamically calculated based on the number of CPUs in the node. This change introduces flexibility in configuring EBS volume sizes, reducing disk space waste and simplifying configuration.
Changes:
-
Dynamic Volume Size Calculation:
- The
CalculateVolumeSizefunction now supports parsing thevolumeSizefield to calculate the size dynamically using theCPUkeyword. - Example:
volumeSize: "10Gi * CPU"calculates the volume size as10Gimultiplied by the number of CPUs in the node.- Static values like
volumeSize: "20Gi"are still supported for backward compatibility.
- The
-
Unit Tests:
- Added comprehensive unit tests in
ec2nodeclass_test.goto validate the behavior of theCalculateVolumeSizefunction. - Test cases include:
- Static volume sizes.
- Dynamic volume sizes using CPU-based formulas.
- Invalid formulas to ensure graceful handling.
- Added comprehensive unit tests in
Benefits:
- Efficiency: Reduces disk space waste by scaling volume sizes dynamically with the node's CPU count.
- Simplicity: Eliminates the need for multiple
EC2NodeClassdefinitions for different node sizes, streamlining configuration.
Testing:
- Unit tests have been added to validate the functionality for various scenarios.
- To run the tests, use the following command:
go test ./pkg/apis/v1 -v
Does this change impact docs?
- [X] Yes, PR includes docs updates
- [ ] Yes, issue opened: #
- [ ] No
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Deploy Preview for karpenter-docs-prod ready!
| Name | Link |
|---|---|
| Latest commit | 2e56b1390f36445bfaed86b5e99abd316564f4af |
| Latest deploy log | https://app.netlify.com/sites/karpenter-docs-prod/deploys/6811d710e9c29e0008710819 |
| Deploy Preview | https://deploy-preview-8024--karpenter-docs-prod.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site configuration.