Closed zosiek666 closed 1 year ago
Did you see the documentation on this module here?
Also,
cloud_formation_template=sc.CloudFormationTemplate.from_product_stack(self)
I'm not sure passing in the stack that contains the CloudFormation Product is supposed to be the pattern
@peterwoodworth Hi, yes I saw that - but this is for lambda and cloudformation stack (where I have code for my lambda and can provide some assetes).
That is not the case here. I have update the example code (CF is not required to replicate issue - only EKS or HELMChart). Like you can see for EKS or HELMChart under the hood CDK is trying to deploy some assets. In my opinion problem is here (EKS documentation)
KubectlHandler - Lambda function for invoking kubectl commands on the cluster - created by CDK.
ClusterHandler - Lambda function for interacting with EKS API to manage the cluster lifecycle - created by CDK.
For HELMChart I think problem is when you want to create EKS cluster from_cluster_attributes
.
Our EKS constructs require a place to put assets to be able to deploy them, so you would have to provide an asset bucket for the stack to upload assets to. Maybe I don't understand what you're trying to say...
Ok so I will give you two examples. One is working, second no:
So we do not know how to provide bucket to assets and why default bucket (that is in first working code, I think create by AWS/CDK) is not pass to ProductStack
The first stack will succeed because it will deploy the assets to the bucket that you've bootstrapped with. ProductStacks are distinct in that you need to specifically name the asset bucket to be able to use assets. You can specify the bucket as an input prop to the ProductStack construct when you instantiate it
import aws_cdk as cdk
from aws_cdk import (
aws_eks as eks,
aws_servicecatalog as sc,
aws_s3 as s3,
App,
)
from constructs import Construct
class EKSProduct(sc.ProductStack):
def __init__(self, scope: Construct, id: str, asset_bucket: s3.Bucket) -> None:
super().__init__(scope, id, asset_bucket=asset_bucket)
cluster = eks.Cluster(self, 'EKSCluster',
default_capacity=0,
version=eks.KubernetesVersion.V1_25,
cluster_name="MySimpleEKSCluster",
)
class WrapperStack(cdk.Stack):
def __init__(self, scope: Construct, id: str) -> None:
super().__init__(scope, id)
bucket = s3.Bucket(self, "Bucket", bucket_name="mybucket")
EKSProduct(self, "EksProductInsideWrapper", asset_bucket=bucket)
app = App()
WrapperStack(app, "WrapperStackForEksProduct")
app.synth()
This issue has not received a response in a while. If you want to keep this issue open, please leave a comment below and auto-close will be canceled.
Describe the bug
On AWS, we are in the process of creating our custom product portfolio through Service Catalog. We wish to include the EKS product in our portfolio. Unfortunately, we encounter an error during the SYNTH and DEPLOY phases. Interestingly, when we attempt to deploy only the EKS product as the primary item, it functions as expected. However, when we try to include it as a product within Service Catalog, we encounter the aforementioned error. Regrettably, we have been unable to find a workaround for this issue. This problem also extends to HELMCharts and Lambdas (code defined in separate file). With Lambdas we have managed to work around the issue by using inline definitions, but still this is also a problem.
Expected Behavior
Synth OK and also successful deployment via CLI
Current Behavior
Reproduction Steps
Create file with below python code and try do cdk-synth
Possible Solution
Allow to create assets for nested stack and wrapped stack, and pass ENV variables to them or allow to pass bucket where it cane be stored.
Additional Information/Context
Try on different python versions , CDK version, Node version and lib version. Also on different systems. Always the same result.
CDK CLI Version
2.98.0 (build b04f852)
Framework Version
aws-cdk-lib==2.98.0
Node.js Version
v18.16.0
OS
OSX 12.6.5, Windows 10, Windows 11
Language
Python
Language Version
Python 3.7.16, Python 3.8.0, Python 3.9.16
Other information
No response