Skip to content

Commit 34160ba

Browse files
committed
fix test and updates docs
1 parent 542ee50 commit 34160ba

File tree

3 files changed

+35
-0
lines changed

3 files changed

+35
-0
lines changed

cmd/clusterawsadm/cloudformation/bootstrap/fixtures/with_allow_assume_role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ Resources:
173173
- ec2:DescribeAddresses
174174
- ec2:DescribeAvailabilityZones
175175
- ec2:DescribeInstances
176+
- ec2:DescribeInstanceTypes
176177
- ec2:DescribeInternetGateways
177178
- ec2:DescribeEgressOnlyInternetGateways
178179
- ec2:DescribeInstanceTypes
@@ -205,6 +206,7 @@ Resources:
205206
- elasticloadbalancing:DeleteTargetGroup
206207
- elasticloadbalancing:DescribeLoadBalancers
207208
- elasticloadbalancing:DescribeLoadBalancerAttributes
209+
- elasticloadbalancing:DescribeTargetGroups
208210
- elasticloadbalancing:ApplySecurityGroupsToLoadBalancer
209211
- elasticloadbalancing:DescribeTags
210212
- elasticloadbalancing:ModifyLoadBalancerAttributes

docs/book/src/topics/multitenancy.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,9 @@ There are multiple AWS assume role permissions that need to be configured in ord
213213
}
214214
```
215215

216+
Both of these permissions can be enabled via clusterawsadm as documented [here](using-clusterawsadm-to-fulfill-prerequisites.md#cross-account-role-assumption).
217+
218+
216219
### Examples
217220

218221
This is a deployable example which uses the `AWSClusterRoleIdentity` "test-account-role" to assume into the `arn:aws:iam::123456789:role/CAPARole` role in the target account.

docs/book/src/topics/using-clusterawsadm-to-fulfill-prerequisites.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,36 @@ spec:
106106
...
107107
```
108108
109+
#### Cross Account Role Assumption
110+
111+
CAPA, by default, does not provide the necessary permissions to allow cross-account role assumption, which can be used to manage clusters in other environments. This is documented [here](multitenancy.md#necessary-permissions-for-assuming-a-role). The 'sts:AssumeRole' permissions can be added via the following configuration on the manager account configuration:
112+
113+
```yaml
114+
apiVersion: bootstrap.aws.infrastructure.cluster.x-k8s.io/v1beta1
115+
kind: AWSIAMConfiguration
116+
spec:
117+
...
118+
allowAssumeRole: true
119+
...
120+
```
121+
122+
The above will give the controller to have the necessary permissions needed in order for it to manage clusters in other accounts using the AWSClusterRoleIdentity. Please note, the above should only be applied to the account where CAPA is running. To allow CAPA to assume the roles in the managed/target accounts, the following configuration needs to be used:
123+
```yaml
124+
apiVersion: bootstrap.aws.infrastructure.cluster.x-k8s.io/v1beta1
125+
kind: AWSIAMConfiguration
126+
spec:
127+
...
128+
clusterAPIControllers:
129+
disabled: false
130+
trustStatements:
131+
- Action:
132+
- "sts:AssumeRole"
133+
Effect: "Allow"
134+
Principal:
135+
AWS:
136+
- "arn:aws:iam::<manager account>:role/controllers.cluster-api-provider-aws.sigs.k8s.io"
137+
...
138+
```
109139
110140
111141
### Without `clusterawsadm`

0 commit comments

Comments
 (0)