cdk-eks-blueprints icon indicating copy to clipboard operation
cdk-eks-blueprints copied to clipboard

(cluster-providers): Blueprint creates new VPC in case existing VPC is passed by MngClusterProviderProps.vpc

Open pflorek opened this issue 3 years ago • 3 comments

Describe the bug

If I create a MngClusterProvider and pass an existing vpc by MngClusterProviderProps.vpc, EksBlueprint still creates a new CDK VPC with default settings.

    const clusterProvider = new blueprints.MngClusterProvider({
      vpc: props.vpc,
    });
    
    blueprints.EksBlueprint.builder()
      .clusterProvider(clusterProvider)
      .build(scope, id, props);

What's the recommended way to configure the cluster's vpc?

Expected Behavior

EksBlueprint either will warn me or throw an error, if I override ClusterProps.vpc while not configuring the vpc provider

Current Behavior

It creates an additional vpc

Reproduction Steps

    const clusterProvider = new blueprints.MngClusterProvider({
      vpc: props.vpc,
    });
    
    blueprints.EksBlueprint.builder()
      .clusterProvider(clusterProvider)
      .build(scope, id, props);

Possible Solution

If vpc is passed by as ClusterOptions on a ClusterProvider, we may help the user:

  1. Add a warning
  2. Throw an error
  3. Update the jsdoc block
  4. Don't extends props from eks.ClusterOptions

Additional Information/Context

No response

CDK CLI Version

2.37.1

EKS Blueprints Version

1.2.0

Node.js Version

18.7.0

Environment details (OS name and version, etc.)

MacOS

Other information

No response

pflorek avatar Aug 17 '22 09:08 pflorek

The way to pass the VPC is through resource providers, which I saw you are aware of. I will exclude vpc and other options that cannot be set directly from the props. It is a defect.

shapirov103 avatar Aug 18 '22 05:08 shapirov103

lib/cluster-providers/mng-cluster-provider.ts

export interface MngClusterProviderProps extends eks.CommonClusterOptions, Omit<ManagedNodeGroup, "id"> {

Maybe not to inherit props from eks.CommonClusterOptions. Overriding them won't work well with jsii later on

pflorek avatar Aug 18 '22 11:08 pflorek

It is a good point. For language support our strategy is to take full advantage of language features so if we were to support python or Go it will be an SDK designed for those languages.

shapirov103 avatar Aug 18 '22 14:08 shapirov103

@pflorek Do you still have issues or could we go ahead and close this ticket.

elamaran11 avatar May 11 '23 15:05 elamaran11