-
Notifications
You must be signed in to change notification settings - Fork 314
Add iam_lambda_role parameter under cluster section in the config file #2304
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
Add iam_lambda_role parameter under cluster section in the config file #2304
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #2304 +/- ##
===========================================
+ Coverage 61.61% 61.63% +0.01%
===========================================
Files 40 40
Lines 6146 6151 +5
===========================================
+ Hits 3787 3791 +4
- Misses 2359 2360 +1
Continue to review full report at Codecov.
|
494b7b4 to
1b47fa4
Compare
| return boto3.client("iam", region_name=region).create_policy( | ||
| PolicyName=iam_policy_name, PolicyDocument=parallel_cluster_instance_policy | ||
| )["Policy"]["Arn"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried using troposphere to create the policy. But it is hard to covert the policy json to the required awacs.aws.PolicyDocument object. In other words, troposphere does not accept json as the PolicyDocument.
Of course, we can use static CloudForamtion templates
c641e68 to
e11716d
Compare
CHANGELOG.md
Outdated
| failures due to CloudFormation throttling. | ||
| - Add support for io2 EBS volume type. | ||
| - Add `iam_lambda_role` parameter under `cluster` section to enable the possibility to specify an existing IAM role to | ||
| be used with AWS Lambda functions that implement CustomResources in CloudFormation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
...to be used with AWS Lambda functions that implement CustomResources in CloudFormation. --> ...to be used by AWS Lambda Functions part of the CloudFormation template. or something like this? up to you.
| ) | ||
|
|
||
|
|
||
| def _create_iam_policies(iam_policy_name, region, policy_filename): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: I'd rename it to _render_iam_policies, The "render" word highlights the fact we're using jinja.
tests/integration-tests/tests/iam/test_iam/test_iam_roles/HIT.update.ini
Outdated
Show resolved
Hide resolved
| @@ -1,54 +0,0 @@ | |||
| # Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good to see this file as modified file instead of removed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried refactor it again. But it seems github only recognize move without change of the content
tests/integration-tests/tests/iam/test_iam/test_iam_roles/SIT.update.ini
Show resolved
Hide resolved
6091c3f to
9ec981a
Compare
6db2e6a to
3a45e25
Compare
2ef605b to
d50dfc8
Compare
1. Add `iam_lambda_role` parameter to the config file. If specified, this role will be attached to all Lambda function resources created by CloudFormation Templates. 2. If both `ec2_iam_role` and `iam_lambda_role` are provided, and the scheduler is `sge`, `torque`, or `slurm`, there will be no created by `pcluster` commands. Note that if `awsbatch` is the scheduler, there will be role created during `pcluster create`. 3. Integration tests: Extract some functions (role creation, policy creation) from `storage.kms_key_factory` to `conftest`. The code in `kms_key_factory` is kept untouched to limit the scale of this commit. Signed-off-by: Hanwen <hanwenli@amazon.com>
d50dfc8 to
1546d8f
Compare
…tion This PR will complete the leftover from aws#2304. In that PR, we duplicated code for IAM policies, IAM roles creation. We didn't clean up the duplication to limit the scale of that PR. Moreover, this PR will scope the fixtures for IAM policies, IAM roles, KMS keys to session, allowing reusing of the resources across tests. Note that the resources are not reused across parallel test runs. Signed-off-by: Hanwen <hanwenli@amazon.com>
…tion This PR will complete the leftover from aws#2304. In that PR, we duplicated code for IAM policies, IAM roles creation. We didn't clean up the duplication to limit the scale of that PR. Moreover, this PR will scope the fixtures for IAM policies, IAM roles, KMS keys to session, allowing reusing of the resources across tests. Note that the resources are not reused across parallel test runs. Signed-off-by: Hanwen <hanwenli@amazon.com>
…tion This PR will complete the leftover from aws#2304. In that PR, we duplicated code for IAM policies, IAM roles creation. We didn't clean up the duplication to limit the scale of that PR. Moreover, this PR will scope the fixtures for IAM policies, IAM roles, KMS keys to session, allowing reusing of the resources across tests. Note that the resources are not reused across parallel test runs. Signed-off-by: Hanwen <hanwenli@amazon.com>
iam_lambda_roleparameter to the config file. If specified, this role will be attached to all Lambda function resources created by CloudFormation templates.ec2_iam_roleandiam_lambda_roleare provided, and the scheduler issge,torque, orslurm, there will be no role created bypclustercommands. Note that ifawsbatchis the scheduler, there will be role created duringpcluster create.storage.kms_key_factorytoconftest. The code inkms_key_factoryis kept untouched to limit the scale of this commit.Signed-off-by: Hanwen hanwenli@amazon.com
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
This change is verified by the following tests: