colossal-rose-51845
12/05/2024, 2:40 PMerror: eks:index:Cluster resource 'tests' has a problem: Invalid net address:
error: Error: Invalid net address:
at new Netmask (/snapshot/eks/node_modules/netmask/lib/netmask.js:150:15)
at Netmask.contains (/snapshot/eks/node_modules/netmask/lib/netmask.js:166:14)
at isPrivateCIDRBlock (/snapshot/eks/bin/nodegroup.js:923:22)
at /snapshot/eks/bin/nodegroup.js:876:93
at Array.find (<anonymous>)
at /snapshot/eks/bin/nodegroup.js:876:63
at Generator.next (<anonymous>)
at fulfilled (/snapshot/eks/bin/nodegroup.js:18:58)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
• First screenshot works
• Second screenshot errors
Where should I file this?modern-zebra-45309
12/05/2024, 2:42 PMmodern-zebra-45309
12/05/2024, 2:43 PMcolossal-rose-51845
12/05/2024, 2:54 PMcolossal-rose-51845
12/05/2024, 2:55 PMcolossal-rose-51845
12/06/2024, 8:01 PMconst hasInternetGatewayRoute =
routeTable.routes.find((r) => !!r.gatewayId && !isPrivateCIDRBlock(r.cidrBlock)) !==
undefined;
The function definition is here https://github.com/pulumi/pulumi-eks/blob/9c128c548765c9829b2d2f1cddcd7d3e74685e7a/nodejs/eks/nodegroup.ts#L1671-L1683
function isPrivateCIDRBlock(cidrBlock: string): boolean {
const privateA = new netmask.Netmask("10.0.0.0/8");
const privateB = new netmask.Netmask("172.16.0.0/12");
const privateC = new netmask.Netmask("192.168.0.0/16");
return (
privateA.contains(cidrBlock) || privateB.contains(cidrBlock) || privateC.contains(cidrBlock)
);
}
As you can see, the netmasks are hardcoded for IPv4 private ranges.
The netmask package only mentions IPv4 support cf
The Netmask class parses and understands IPv4 CIDR blocks so they can be explored and compared.
colossal-rose-51845
12/06/2024, 8:03 PMmodern-zebra-45309
12/06/2024, 8:10 PMcolossal-rose-51845
12/06/2024, 8:13 PMcolossal-rose-51845
12/06/2024, 8:14 PMcontains function call as it only supports IPv4modern-zebra-45309
12/06/2024, 8:21 PMmodern-zebra-45309
12/06/2024, 8:23 PMmodern-zebra-45309
12/06/2024, 8:28 PMcolossal-rose-51845
12/06/2024, 8:34 PMmodern-zebra-45309
12/06/2024, 8:37 PMmodern-zebra-45309
12/06/2024, 8:38 PMcolossal-rose-51845
12/06/2024, 8:39 PM"privateSubnetIds": "${vpc.outputs[\"privateSubnetIds\"]}",
"publicSubnetIds": "${vpc.outputs[\"publicSubnetIds\"]}",colossal-rose-51845
12/06/2024, 8:40 PMCurrent stack outputs (10):
OUTPUT VALUE
internetGatewayId igw-066ebe921971f06b5
natGatewayIds ["nat-092809d7c789b8b93","nat-080329705491b8233","nat-08444fa08a95e18f4"]
privateSubnetIds ["subnet-093feb5ce24bd0d0f","subnet-084ab3f095c254830","subnet-016a9548afe19f30a"]
publicSubnetIds ["subnet-03c19c7ba6cdc830a","subnet-0dc6479a9415c2778","subnet-0773c4b402181cdf9"]modern-zebra-45309
12/06/2024, 8:40 PMmodern-zebra-45309
12/06/2024, 8:42 PMcolossal-rose-51845
12/06/2024, 8:44 PMmodern-zebra-45309
12/06/2024, 8:48 PMnodeSubnetIds nor privateSubnetIds nor publicSubnetIds is set should the worker subnets be auto-selected by trying to find the private subnets from subnetIds.modern-zebra-45309
12/06/2024, 8:48 PMcolossal-rose-51845
12/06/2024, 8:50 PMsubnetIds I get the expected error message.
Diagnostics:
pulumi:pulumi:Stack (mdft-tests-eks):
error: eks:index:Cluster resource 'tests' has a problem: subnetIds, and the use of publicSubnetIds and/or privateSubnetIds are mutually exclusive. Choose a single approach.colossal-rose-51845
12/06/2024, 8:54 PMcolossal-rose-51845
12/06/2024, 8:54 PMipFamily but it becomes kubernetesNetworkConfig.IpFamily in the statecolossal-rose-51845
12/06/2024, 8:55 PMvpcConfig": {
"__defaults": [],
"subnet-03c19c7ba6cdc830a",
"subnet-0dc6479a9415c2778",
"subnet-0773c4b402181cdf9",
"subnet-093feb5ce24bd0d0f",
"subnet-084ab3f095c254830",
"subnet-016a9548afe19f30a"
]
}modern-zebra-45309
12/06/2024, 8:55 PMcore as returned in https://github.com/pulumi/pulumi-eks/blob/master/nodejs/eks/nodegroup.ts#L653 has the appropriate subnetId outputs?modern-zebra-45309
12/06/2024, 8:56 PMmodern-zebra-45309
12/06/2024, 8:59 PMipFamily but it becomes kubernetesNetworkConfig.IpFamily in the state
This happens here: https://github.com/pulumi/pulumi-eks/blob/master/nodejs/eks/cluster.ts#L579-L589 Looks entirely unrelated to the subnetIds, I don't see a location in the code where there could be interactioncolossal-rose-51845
12/06/2024, 8:59 PMaws:eks:Cluster resource underneath
Here's what I get
+ privateSubnetIds : [
+ [0]: "subnet-093feb5ce24bd0d0f"
+ [1]: "subnet-084ab3f095c254830"
+ [2]: "subnet-016a9548afe19f30a"
]
+ provider : {}
+ publicSubnetIds : [
+ [0]: "subnet-03c19c7ba6cdc830a"
+ [1]: "subnet-0dc6479a9415c2778"
+ [2]: "subnet-0773c4b402181cdf9"
]
+ storageClasses : {}
+ subnetIds : [
+ [0]: "subnet-03c19c7ba6cdc830a"
+ [1]: "subnet-0dc6479a9415c2778"
+ [2]: "subnet-0773c4b402181cdf9"
+ [3]: "subnet-093feb5ce24bd0d0f"
+ [4]: "subnet-084ab3f095c254830"
+ [5]: "subnet-016a9548afe19f30a"modern-zebra-45309
12/06/2024, 9:00 PMcolossal-rose-51845
12/06/2024, 9:12 PMif (args.publicSubnetIds !== undefined || args.privateSubnetIds !== undefined) {
clusterSubnetIds = pulumi
.all([args.publicSubnetIds || [], args.privateSubnetIds || []])
.apply(([publicIds, privateIds]) => {
return [...publicIds, ...privateIds];
});
}modern-zebra-45309
12/06/2024, 9:13 PMmodern-zebra-45309
12/06/2024, 9:14 PMcluster.subnetIds is populated here: https://github.com/pulumi/pulumi-eks/blob/master/nodejs/eks/cluster.ts#L601modern-zebra-45309
12/06/2024, 9:14 PMsubnetIds is the combination of the private and public subnet IDsmodern-zebra-45309
12/06/2024, 9:15 PMsubnetIds is not involved in the checks that should prevent the auto-discovery from being triggeredmodern-zebra-45309
12/06/2024, 9:17 PMsubnetIdsmodern-zebra-45309
12/06/2024, 9:19 PMcore is an instance of aws.eks.Cluster rather than an instance of CoreDataArgs, you'll end up with the check that's failing for you, because there's no aws.eks.Cluster.privateSubnetIdsmodern-zebra-45309
12/06/2024, 9:24 PMargs.cluster ?modern-zebra-45309
12/06/2024, 9:25 PMcolossal-rose-51845
12/06/2024, 9:25 PMcolossal-rose-51845
12/06/2024, 9:26 PMargs.clustercolossal-rose-51845
12/06/2024, 9:29 PM"skipDefaultNodeGroup": true,colossal-rose-51845
12/06/2024, 9:30 PMfargate set to true. This is so weirdcolossal-rose-51845
12/06/2024, 10:15 PMmodern-zebra-45309
12/07/2024, 11:00 AMAnd I also haveThat's actually getting us closer: https://github.com/pulumi/pulumi-eks/blob/master/nodejs/eks/cluster.ts#L1040-L1042 Setting up the FargateProfile takes the joint clusterSubnetIds and tries to divide them againset to true. This is so weirdfargate
modern-zebra-45309
12/07/2024, 11:07 AM