-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
aws_eks: kubectl function shouldn't require the vpc when endpointAccess is PUBLIC_AND_PRIVATE #27055
Comments
We developed a hacky fix here using the escape hatches ... let kubectlProvider = Stack.of(this).node.findChild('@aws-cdk/aws-eks.KubectlProvider');
let handler = kubectlProvider.node.findChild('Handler');
let resource = handler.node.findChild('Resource') as CfnFunction;
resource.vpcConfig = undefined;
|
Looks like there's another resource in the provider framework that needs to also have the vpcConfig removed to fix the issue: // onevent handler
let provider = kubectlProvider.node.findChild('Provider');
let framework = provider.node.findChild('framework-onEvent');
let onEventResource = framework.node.findChild('Resource') as CfnFunction;
onEventResource.vpcConfig = undefined; |
I can't comment on why the handler is placed inside the private side of the VPC except that I would assume that it is in fact for the purposes of security. Please also understand that this team cannot see AWS cases. While this workaround isn't great, I'm glad it works for you. |
@indrora, |
Hi @diranged, Thanks for raising the issue. There are 2 lambda functions involved here:
We're about to rewrite the current EKS module and will definitely consider your feedback when making decisions. Thanks! |
Describe the bug
See AWS Case ID
#13749604991
for more details.We've been working on building out new EKS clusters based on CDK rather than native CloudFormation. As part of that, we're iterating with the integration test runner. We were struggling to understand why the
DELETE
process for the tests was taking 30+m, when we discovered that theKubectlHandler
function is being created inside the VPC. This was surprising to us, as we specifically are not requiring that (we are not setting theplaceClusterHandlerInVpc
flag).It turns out that the
Cluster
class makes the decision to place theKubectlHandler
into the VPC at https://github.com/aws/aws-cdk/blob/main/packages/aws-cdk-lib/aws-eks/lib/cluster.ts#L1594:While yes .. we want our clusters to be PUBLCI and PRIVATE so that within the VPC, API calls can go directly to the API without leaving the network. On the other hand, we couldn't care less about the Lambda function being inside the VPC. According to our case rep, any time a
DELETE
call is made to a Lambda function with attached ENIs, there is a 20m delay between the DELETE starting and finishing. This delay adds a huge amount of wasted time to our integration tests and basically slows everything down for little value.Expected Behavior
I would expect that if the cluster is
PUBLIC_AND_PRIVATE
, and I setplaceClusterHandlerInVpc: false
, that the Lambda functions would indeed NOT be placed in the VPC.Current Behavior
They are placed in the VPC, regardless of our
placeClusterHandlerInVpc
setting.Reproduction Steps
Create a cluster with PUBLIC_AND_PRIVATE set ... then try deleting it. Watch it take 20 minutes to delete.
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.94.0
Framework Version
No response
Node.js Version
18
OS
linux
Language
Typescript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: