Skip to content

Commit cbda801

Browse files
committed
fix
1 parent a8602d8 commit cbda801

File tree

2 files changed

+6
-33
lines changed

2 files changed

+6
-33
lines changed

packages/aws-cdk-lib/aws-eks/README.md

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1142,38 +1142,6 @@ You can disable granting the cluster admin permissions to the cluster creator ro
11421142

11431143
> **Note** - Switching `bootstrapClusterCreatorAdminPermissions` on an existing cluster would cause cluster replacement and should be avoided in production.
11441144
1145-
When a `FargateCluster` is created with `AuthenticationMode.API`, by default the cluster creator role would be added into the AccessEntry with `AmazonEKSClusterAdminPolicy` unless `bootstrapClusterCreatorAdminPermissions` is disabled.
1146-
1147-
For example:
1148-
1149-
```ts
1150-
import { KubectlV30Layer } from '@aws-cdk/lambda-layer-kubectl-v30';
1151-
declare const vpc: ec2.Vpc;
1152-
declare const myPrincipal: iam.IPrincipal
1153-
1154-
const cluster = new eks.FargateCluster(this, 'FargateCluster', {
1155-
vpc,
1156-
version: eks.KubernetesVersion.V1_30,
1157-
authenticationMode: eks.AuthenticationMode.API
1158-
});
1159-
1160-
// allow custom principal to assume the cluster creator role
1161-
cluster.adminRole.assumeRolePolicy?.addStatements(
1162-
new iam.PolicyStatement({
1163-
actions: ['sts:AssumeRole'],
1164-
principals: [myPrincipal],
1165-
}),
1166-
);
1167-
1168-
// generate the cluster config command that updates the kubeconfig using the cluster creator role
1169-
new CfnOutput(this, 'ClusterConfigCommand', {
1170-
value:
1171-
`aws eks update-kubeconfig --name ${cluster.clusterName} --region ${Stack.of(cluster).region} --role-arn ${cluster.adminRole.roleArn}`,
1172-
});
1173-
```
1174-
1175-
Now, by running the cluster config command, your kubeconfig would be updated and `kubectl` would assume the cluster creator role for operations.
1176-
11771145
### Access Entry
11781146

11791147
An access entry is a cluster identity—directly linked to an AWS IAM principal user or role that is used to authenticate to

packages/aws-cdk-lib/aws-eks/lib/fargate-profile.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,12 @@ export class FargateProfile extends Construct implements ITaggable {
201201
resource.node.addDependency(previousProfile);
202202
}
203203

204-
const supportConfigMap = props.cluster.authenticationMode !== AuthenticationMode.API ? true : false;
204+
const supportConfigMap = [
205+
undefined,
206+
AuthenticationMode.CONFIG_MAP,
207+
AuthenticationMode.API_AND_CONFIG_MAP
208+
].includes(props.cluster.authenticationMode);
209+
205210
if (supportConfigMap) {
206211
// map the fargate pod execution role to the relevant groups in rbac
207212
// see https://github.com/aws/aws-cdk/issues/7981

0 commit comments

Comments
 (0)