-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(eks-v2-alpha): prevent IAM role creation when node pools are empty #33894
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 whennodeRoleArn
is provided, node pool values must also be provided.Description of changes
Modified the
computeConfig
section in theCfnCluster
resource to check ifnodePools
is empty before assigningnodeRoleArn
. IfnodePools
is empty,nodeRoleArn
will be set toundefined
to 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.ts
that verifies:nodeRoleArn
property 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