fix(eks-v2-alpha): prevent IAM role creation when node pools are empty#33894
fix(eks-v2-alpha): prevent IAM role creation when node pools are empty#33894mergify[bot] merged 6 commits intoaws:mainfrom
Conversation
…empty When node pools are disabled (by setting an empty array in nodePools), the IAM role will not be created, preventing deployment failures with the error 'When Compute Config nodeRoleArn is not null or empty, nodePool value(s) must be provided'. Fixes aws#33771
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33894 +/- ##
=======================================
Coverage 82.35% 82.35%
=======================================
Files 120 120
Lines 6941 6941
Branches 1172 1172
=======================================
Hits 5716 5716
Misses 1120 1120
Partials 105 105
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
LGTM, Thanks @pahud for adding integration test |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
|
Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork). |
|
Comments on closed issues and PRs are hard for our team to see. |
When node pools are disabled (by setting an empty array in nodePools), the IAM role will not be created, preventing deployment failures with the error 'When Compute Config nodeRoleArn is not null or empty, nodePool value(s) must be provided.
Issue # (if applicable)
Fixes #33771
Reason for this change
When using EKS Auto Mode with empty node pools (by setting
nodePools: []), the IAM role was still being created by the L2 construct, causing stack deployment failures. The AWS service returns an error stating that whennodeRoleArnis provided, node pool values must also be provided.Description of changes
Modified the
computeConfigsection in theCfnClusterresource to check ifnodePoolsis empty before assigningnodeRoleArn. IfnodePoolsis empty,nodeRoleArnwill be set toundefinedto prevent the unnecessary creation of the IAM role.The change ensures that when users explicitly disable node pools by providing an empty array, the IAM role won't be created, allowing the cluster to be provisioned successfully.
Added a test case to verify that when node pools are empty:
Describe any new or updated permissions being added
No new or updated IAM permissions are being added. This change actually prevents the creation of an IAM role when it's not needed.
Description of how you validated changes
Added a new test case in
automode.test.tsthat verifies:nodeRoleArnproperty is not included in the CloudFormation template when node pools are emptyThe test passes, confirming that our fix works as expected.
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license