Skip to content

Commit cdf1f02

Browse files
authored
Merge pull request #3416 from sedefsavas/assumerole-doc
Add role assumption trust policy example to book
2 parents a47147d + 30b75f6 commit cdf1f02

File tree

1 file changed

+36
-8
lines changed

1 file changed

+36
-8
lines changed

docs/book/src/topics/multitenancy.md

Lines changed: 36 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ For details, see the [multi-tenancy proposal](https://github.com/kubernetes-sigs
66

77
For multi-tenancy support, a reference field (`identityRef`) is added to `AWSCluster`, which informs the controller of which identity to be used when reconciling the cluster.
88
If the identity provided exists in a different AWS account, this is the mechanism which informs the controller to provision a cluster in a different account.
9+
Identities should have adequate permissions for CAPA to reconcile clusters.
910

1011

1112
```yaml
@@ -179,6 +180,41 @@ spec:
179180
name: multi-tenancy-role
180181
```
181182

183+
184+
### Necessary permissions for assuming a role:
185+
186+
There are multiple AWS assume role permissions that need to be configured in order for the assume role to work:
187+
- The source identity (user/role specified in the source identity field) should have IAM policy permissions that enable it to perform sts:AssumeRole operation.
188+
```json
189+
{
190+
"Version": "2012-10-17",
191+
"Statement": [
192+
{
193+
"Effect": "Allow",
194+
"Action": "sts:AssumeRole",
195+
"Resource": "*"
196+
}
197+
]
198+
}
199+
```
200+
201+
- The target role (can be in a different AWS account) must be configured to allow the source user/role (or all users in an AWS account) to assume into it by setting a trust policy:
202+
``` json
203+
{
204+
"Version": "2012-10-17",
205+
"Statement": [
206+
{
207+
"Effect": "Allow",
208+
"Principal": {
209+
"AWS": "arn:aws:iam::111111111111:root"
210+
// "AWS": "arn:aws:iam::111111111111:role/role-used-during-cluster-bootstrap"
211+
},
212+
"Action": "sts:AssumeRole"
213+
}
214+
]
215+
}
216+
```
217+
182218
### Examples
183219

184220
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.
@@ -239,14 +275,6 @@ In order to use the [EC2 template](../../../../templates/cluster-template.yaml)
239275

240276
Similarly, to use the [EKS template](../../../../templates/cluster-template-eks.yaml) with identity type, you can add the `identityRef` section to `kind: AWSManagedControlPlane` spec section in the template. If you do not, CAPA will automatically add the default identity provider (which is usually your local account credentials).
241277

242-
#### Permissions
243-
244-
There are multiple AWS assume role permissions that need to be configured in order for the assume role to work
245-
- The Primary role in the management account must be allowed to assume role into the target role account
246-
- This is traditionally the controller role, but the operator can configure it to be any role
247-
- The target account role must be configured to allow the management role to assume into it
248-
- The target account role must have adequate permissions for cluster-api to build both EC2 and EKS based clusters
249-
250278
## Secure Access to Identities
251279
`allowedNamespaces` field is used to grant access to the namespaces to use Identities.
252280
Only AWSClusters that are created in one of the Identity's allowed namespaces can use that Identity.

0 commit comments

Comments
 (0)