cdk8s-core
cdk8s-core copied to clipboard
Error creating Chart with aws-cdk Construct scope
I'm creating a cdk8s Chart in an aws-cdk project, using the following dependencies versions:
"aws-cdk-lib": "^2.0.0",
"cdk8s": "^2.0.0",
"constructs": "^10.0.0",
Using an aws-cdk Construct as the parent scope for the Chart, I'm getting: 'Error: cannot find a parent chart (directly or indirectly)'
import { Construct } from 'constructs';
import { App as AwsApp, Stack } from 'aws-cdk-lib';
import { Cluster, KubernetesVersion } from 'aws-cdk-lib/aws-eks';
import { App as K8sApp, Chart } from 'cdk8s';
class MyStack extends Stack {
constructor(scope: Construct, id: string) {
super(scope, id);
const cluster = new Cluster(this, 'Cluster', { version: KubernetesVersion.V1_21 });
cluster.addCdk8sChart('Test1', new Chart(this, 'Test1')); // <--- NOT WORKS
cluster.addCdk8sChart('Test2', new Chart(new K8sApp(), 'Test2')); // <--- WORKS
}
}
new MyStack(new AwsApp(), 'MyStack');
Which is the intent of Ecosystem Interoperability if the parent scope of a cdk8s Construct can't be an aws-cdk Construct?