Open mattdavis90 opened 6 months ago
@mattdavis90 are you saying the _definitions.json
that gets generated from your includes both core k8s resources AND CRDs? If its just CRDs than you can curl
it locally, and then run cdk8s import /path/to/file
.
If they include both, thats tricky because our code currently dispatches fairly different code paths for core resources vs CRDs.
Hi, the code exposes both k8s resources and CRDs within the same _definitions.json
with the, admittedly little, testing that I did it seemed to work as expected by simply changing the import URL.
Changing the import URL makes it treat the file as only containing CDRs, probably ignoring core resources....
It's not a bad idea though to have cdk8s be able to treat each properly, no matter where it comes from.
Description of the feature or enhancement:
Add a command line option to
cdk8s import k8s
to point to a custom URL instead of the default (hardcoded) one. Something along the lines ofcdk8s import k8s:http://127.0.0.1/_definitions.json
.Use Case:
I've created a project that generates a dynamic
_definitions.json
from your running Kubernetes installation and wanted to use this with thecdk8s import k8s
command to have cdk8s generate imports that include all of my CRDs automatically without me specifying each one individually.Currently the URL for k8s is hardcoded. By changing the file
node_modules/cdk8s-cli/lib/import/k8s.js
I can point to my URL and CDK8s successfully generates import files from my live deployment.Suggested implementation
Similar to
github
andhelm
imports take a URL, allow something likecdk8s import k8s:<url>
or add a CLI option such as--custom-url
.I'm happy to have a go at implementing this feature but wanted to find out if others are interested before opening a PR and also what the preferred means of specifying the URL would be.
Thanks
This is a :rocket: Feature Request