-
Notifications
You must be signed in to change notification settings - Fork 4k
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
(eks): KubectlProvider
creates un-necessary security group for the provider function
#12952
Comments
@pkwarren You mention in the title this happens when upgrading from I'll classify this as a feature request, but feel free to let me know if you think i'm missing something. |
KubectlProvider
functions
When I look through the history the behavior changed starting in 1.80.0 of aws-cdk. We encountered the issue when updating from 1.77.0 to 1.87.1 and have since rolled back (we prohibit creation of new security groups by the CDK pipeline). |
@pkwarren You're right, the lambda function now creates the security group only because a VPC is passed to it. Which was changed in the PR you referenced. Thanks for reporting this 👍 |
KubectlProvider
functionsKubectlProvider
creates un-necessary security group for the provider function
Following #10200, our `KubectlProvider` functions are now provisioned inside a VPC when applicable. A somewhat unintended side effect is that the provider framework will **create** and use a dedicated security group for its functions. This can violate organizational policies that don't allow CDK to create security groups. We can easily avoid this by simply reusing the `kubectlSecurityGroup`, which must be defined in this case, and passing it to the provider. Fixes #12952 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
|
Following #10200, our `KubectlProvider` functions are now provisioned inside a VPC when applicable. A somewhat unintended side effect is that the provider framework will **create** and use a dedicated security group for its functions. This can violate organizational policies that don't allow CDK to create security groups. We can easily avoid this by simply reusing the `kubectlSecurityGroup`, which must be defined in this case, and passing it to the provider. Fixes #12952 ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
The fix for #10200 updated the custom-resources provider to pass along the
vpc
andvpcSubnets
ProviderProps. It however isn't passing down any configured security groups, which causes a new security group to be created for the lambdas.It would help to reduce unnecessary security groups created by CDK if we could configure the security group for these lambdas or re-use
cluster.kubectlSecurityGroup
(if set).Reference:
aws-cdk/packages/@aws-cdk/aws-eks/lib/kubectl-provider.ts
Lines 107 to 108 in e21a1d9
aws-cdk/packages/@aws-cdk/aws-lambda/lib/function.ts
Lines 862 to 867 in e21a1d9
Reproduction Steps
Import a k8s cluster with
fromClusterAttributes
(with a configured vpc) and call addServiceAccount. In the nested stack, you'll see a security group created for the custom-resources lambdas:What did you expect to happen?
The custom-resources lambdas to be configured using the same security group as specified by
cluster.kubectlSecurityGroup
.What actually happened?
A new security group is created for each CDK stack which creates a k8s service account.
Environment
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: