Skip to content

Commit

Permalink
feat(eks): add warning to fargateProfile (#16631)
Browse files Browse the repository at this point in the history
partially fixes #16349 

----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
  • Loading branch information
peterwoodworth authored Sep 23, 2021
1 parent 1c25836 commit 41fdebb
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/@aws-cdk/aws-eks/lib/fargate-profile.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as ec2 from '@aws-cdk/aws-ec2';
import * as iam from '@aws-cdk/aws-iam';
import { CustomResource, ITaggable, Lazy, TagManager, TagType } from '@aws-cdk/core';
import { Annotations, CustomResource, ITaggable, Lazy, TagManager, TagType } from '@aws-cdk/core';
import { Construct } from 'constructs';
import { Cluster } from './cluster';
import { FARGATE_PROFILE_RESOURCE_TYPE } from './cluster-resource-handler/consts';
Expand Down Expand Up @@ -156,6 +156,10 @@ export class FargateProfile extends CoreConstruct implements ITaggable {

this.podExecutionRole.grantPassRole(props.cluster.adminRole);

if (props.subnetSelection && !props.vpc) {
Annotations.of(this).addWarning('Vpc must be defined to use a custom subnet selection. All private subnets belonging to the EKS cluster will be used by default');
}

let subnets: string[] | undefined;
if (props.vpc) {
const selection: ec2.SubnetSelection = props.subnetSelection ?? { subnetType: ec2.SubnetType.PRIVATE };
Expand Down

0 comments on commit 41fdebb

Please sign in to comment.