(cluster-providers): Blueprint creates new VPC in case existing VPC is passed by MngClusterProviderProps.vpc
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:
- Add a warning
- Throw an error
- Update the jsdoc block
- 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
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.
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
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.
@pflorek Do you still have issues or could we go ahead and close this ticket.