You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/book/src/topics/multitenancy.md
+78-6Lines changed: 78 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,9 @@ Starting from v0.6.5, single controller multi-tenancy is supported that allows u
4
4
For details, see the [multi-tenancy proposal](https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/main/docs/proposal/20200506-single-controller-multitenancy.md).
5
5
6
6
7
-
For multi-tenancy support, a reference field (`identityRef`) is added to `AWSCluster`, which describes the identity to be used when reconciling the cluster.
7
+
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.
8
+
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.
list: # allows only "test" namespace to use this identity
139
-
"test"
143
+
- "test" # allows only "test" namespace to use this identity
140
144
roleARN: "arn:aws:iam::123456789:role/CAPARole"
141
145
sourceIdentityRef:
142
-
kind: AWSClusterStaticIdentity
143
-
name: test-account-creds
146
+
kind: AWSClusterControllerIdentity # use the singleton for root auth
147
+
name: default
144
148
```
145
149
146
150
Nested role assumption is also supported.
@@ -175,6 +179,74 @@ spec:
175
179
name: multi-tenancy-role
176
180
```
177
181
182
+
### Examples
183
+
184
+
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.
185
+
This example assumes that the `CAPARole` has already been configured in the target account.
186
+
187
+
Finally, we inform the `Cluster` to use our `AWSCluster`type to provision a cluster in the target account specified by the `identityRef` section.
188
+
189
+
**Note**
190
+
191
+
By default the `AutoControllerIdentityCreator=true` feature gate is set to `true` [here](https://github.com/kubernetes-sigs/cluster-api-provider-aws/blob/412d310654c6b05f1b4bc3d319f6957a07c009c2/feature/feature.go?rgh-link-date=2022-03-23T14%3A57%3A46Z#L81).
192
+
If this is not enabled for your cluster, you will need to enable the flag, or create your own default `AWSClusterControllerIdentity`.
More specific examples can be referenced from the existing [templates](../../../../templates/) directory.
237
+
238
+
In order to use the [EC2 template](../../../../templates/cluster-template.yaml) with identity type, you can add the `identityRef` section to `kind: AWSCluster` spec section in the template. If you do not, CAPA will automatically add the default identity provider (which is usually your local account credentials).
239
+
240
+
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).
241
+
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
+
178
250
## Secure Access to Identities
179
251
`allowedNamespaces`field is used to grant access to the namespaces to use Identities.
180
252
Only AWSClusters that are created in one of the Identity's allowed namespaces can use that Identity.
0 commit comments