Skip to content
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

Import k8s from custom URL #2141

Open
1 task
mattdavis90 opened this issue Feb 10, 2024 · 3 comments
Open
1 task

Import k8s from custom URL #2141

mattdavis90 opened this issue Feb 10, 2024 · 3 comments
Labels
@component/cdk8s-cli Issue related to cdk8s-cli effort/large 1+ weeks feature-request New/Enhanced functionality wanted priority/p2 Dependent on community feedback. PR's are welcome :)

Comments

@mattdavis90
Copy link

mattdavis90 commented Feb 10, 2024

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 of cdk8s 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 the cdk8s 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 and helm imports take a URL, allow something like cdk8s 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


  • 👋 I may be able to implement this feature request

This is a 🚀 Feature Request

@mattdavis90 mattdavis90 added feature-request New/Enhanced functionality wanted needs-triage Priority and effort undetermined yet labels Feb 10, 2024
@iliapolo
Copy link
Member

iliapolo commented Jun 1, 2024

@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.

@iliapolo iliapolo added the response-requested Awaiting response from author label Jun 1, 2024
@mattdavis90
Copy link
Author

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.

@github-actions github-actions bot removed the response-requested Awaiting response from author label Jun 1, 2024
@iliapolo
Copy link
Member

iliapolo commented Jun 2, 2024

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.

@iliapolo iliapolo added effort/large 1+ weeks priority/p2 Dependent on community feedback. PR's are welcome :) and removed needs-triage Priority and effort undetermined yet labels Jun 3, 2024
@iliapolo iliapolo transferred this issue from cdk8s-team/cdk8s-cli Sep 19, 2024
@iliapolo iliapolo added the @component/cdk8s-cli Issue related to cdk8s-cli label Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@component/cdk8s-cli Issue related to cdk8s-cli effort/large 1+ weeks feature-request New/Enhanced functionality wanted priority/p2 Dependent on community feedback. PR's are welcome :)
Projects
None yet
Development

No branches or pull requests

2 participants