(aws-eks): FromClusterAttributes() functions requires parameters at synth time commonly available at deploy time #14058
Labels
@aws-cdk/aws-eks
Related to Amazon Elastic Kubernetes Service
closed-for-staleness
This issue was automatically closed because it hadn't received any attention in a while.
guidance
Question that needs advice or information.
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 7 days.
Finding an existing cluster via CDK
FromClusterAttributes()
may require several arguments, like VPC and OIDC provider id that are frequently available at deploy time.Reproduction Steps
Adding installation of AWS LB Controller and App Mesh Controller that involve creating service accounts, using OIDC and Helm result in
Running
aws eks describe-cluster --name clusterName
returns information on VPC, OIDC, but not a role suitable for kubectl mapped to "system:masters". The latter is understandable, but VPC and OIDC data may be (dare I say likely to be) accessible at deploy time and should be made optional for FromClusterAttributes()What did you expect to happen?
cdk synth should not fail if vpc and OpenIdConnectProvider arguments are not supplied to Cluster.FromClusterAttributes() even if subsequent EKS stack operations require them. diff/deploy should fail only if vpc and OpenIdConnectProvider are not supplied and "aws eks describe-cluster --name clustername" or its equivalent API call does not return required data.
Install AWS LB Controller, AWS App Mesh Controller and App Mesh Ingress Gateway on an existing EKS cluster without having to dig for cluster information accessible to the stack at deploy time.
What actually happened?
I had to create an (imperative) script returning data that is then fed to "cdk deploy -c" (declarative) stack, while I should not be required to do the boilerplate step that could be performed by the stack itself. I also had to add three outputs to another EKS cluster creating stack to supply this information.
"Amazon.JSII.Runtime.JsiiException: "openIdConnectProvider" is not defined for this imported cluster"
"Amazon.JSII.Runtime.JsiiException: "vpc" is not defined for this imported cluster"
Environment
Other
Related to #12468
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: