Skip to content
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

feat(eks): cluster tagging (#4995) #18109

Merged
merged 2 commits into from
Jan 10, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions packages/@aws-cdk/aws-eks/lib/cluster-resource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface ClusterResourceProps {
readonly secretsEncryptionKey?: kms.IKey;
readonly onEventLayer?: lambda.ILayerVersion;
readonly clusterHandlerSecurityGroup?: ec2.ISecurityGroup;
readonly tags?: { [key: string]: string };
}

/**
Expand Down Expand Up @@ -89,6 +90,7 @@ export class ClusterResource extends CoreConstruct {
endpointPrivateAccess: props.endpointPrivateAccess,
publicAccessCidrs: props.publicAccessCidrs,
},
tags: props.tags,
},
AssumeRoleArn: this.adminRole.roleArn,

Expand Down
9 changes: 8 additions & 1 deletion packages/@aws-cdk/aws-eks/lib/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -744,13 +744,19 @@ export interface ClusterProps extends ClusterOptions {
*/
readonly defaultCapacityType?: DefaultCapacityType;


/**
* The IAM role to pass to the Kubectl Lambda Handler.
*
* @default - Default Lambda IAM Execution Role
*/
readonly kubectlLambdaRole?: iam.IRole;

/**
* The tags assigned to the EKS cluster
*
* @default - none
*/
readonly tags?: { [key: string]: string };
}

/**
Expand Down Expand Up @@ -1372,6 +1378,7 @@ export class Cluster extends ClusterBase {
subnets: placeClusterHandlerInVpc ? privateSubnets : undefined,
clusterHandlerSecurityGroup: this.clusterHandlerSecurityGroup,
onEventLayer: this.onEventLayer,
tags: props.tags,
});

if (this.endpointAccess._config.privateAccess && privateSubnets.length !== 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -951,6 +951,9 @@
],
"endpointPublicAccess": true,
"endpointPrivateAccess": true
},
"tags": {
"foo": "bar"
}
},
"AssumeRoleArn": {
Expand Down
3 changes: 3 additions & 0 deletions packages/@aws-cdk/aws-eks/test/integ.eks-cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class EksClusterStack extends TestStack {
defaultCapacity: 2,
version: eks.KubernetesVersion.V1_21,
secretsEncryptionKey,
tags: {
foo: 'bar',
},
});

this.assertFargateProfile();
Expand Down