-
Notifications
You must be signed in to change notification settings - Fork 26
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
Remove instanceof
use when generating JSON manifest from chart
#581
Comments
Thanks for reporting this @dancmeyers. Looking into it 👍 |
As per the request on Slack, some more information about our directory structure: Within our repo we have a
Because we are developing locally, in a monorepo, each library within |
For what it's worth, I managed to get this working by doing the following:
There is then only one copy of |
This is also an issue with the instanceof call in app.ts on line 106. https://github.com/cdk8s-team/cdk8s-core/blob/2.x/src/app.ts#L106 |
This also makes cdk8s-core impossible to use with pnpm (if you decide to split out code to any package libraries). |
That's useful to know, given that a load of our other systems are being moved to pnpm (so we can build them using Bazel), and I was going to try and migrate our CDK too so that we had consistency... |
This pull fixes the issue with instanceof (cdk8s-team#581) by implementing Symbol.hasInstance (thanks to @fikisipi for pointing it out) Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance Signed-off-by: Gjorgji Kjosev <[email protected]>
This pull request fixes the issue with `instanceof` (#581) by implementing `Symbol.hasInstance` (thanks to @fikisipi for pointing it out) Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance I welcome any ideas on how to write tests demonstrating the issue is fixed, as to set things up one needs to have multiple versions (or instances) of the same module. Fixes #581
This pull request fixes the issue with `instanceof` (#581) by implementing `Symbol.hasInstance` (thanks to @fikisipi for pointing it out) Docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/hasInstance I welcome any ideas on how to write tests demonstrating the issue is fixed, as to set things up one needs to have multiple versions (or instances) of the same module. Fixes #581 (cherry picked from commit fea71cc) Signed-off-by: Gorgi Kosev <[email protected]>
This is an issue on at least version 2.3.44 and earlier of
cdk8s
. The actual issue experienced was that, when usingaws-cdk-lib/aws-eks.Cluster.addCdk8sChart
, the resulting CDK template had an emptyManifest
in the custom resource. This occurred after we abstracted out some common low-level CDK8s classes to a library in our monorepo, to make it easier to use the patterns across multiple CDK apps that needed to deploy CDK8s charts to EKS clusters.I eventually tracked the issue down to the
chartToKube
function's use ofinstanceof
:cdk8s-core/src/app.ts
Lines 289 to 294 in 379953a
When classes in a monorepo have been abstracted out to a lib like this, such that both the lib and the app using it have
cdk8s
as a dependency,instanceof
fails to correctly identify the class hierarcy as matching when objects are passed between the two. This is the same issue as experienced inconstructs
in aws/constructs#955 As a result,instanceof
returns false, and the function thinks there are no resources that need jsonifying.The text was updated successfully, but these errors were encountered: