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

create from object feature #1595

Open
zfrhv opened this issue Mar 4, 2024 · 6 comments
Open

create from object feature #1595

zfrhv opened this issue Mar 4, 2024 · 6 comments

Comments

@zfrhv
Copy link

zfrhv commented Mar 4, 2024

hello, i have been looking at the examples and couldn't find any example of creating from object function.
like in the kubernetes python they have create from dict im looking for something similar for js.

all examples describe that in order to create an object you have to use function for that object.
for example for creating namespace you have to run k8sApi.createNamespace(namespace), but i want something like k8sApi.createObject(namespace)

@brendandburns
Copy link
Contributor

There's not a really great example of this, you need an equivalent of the generic client in Java, but it doesn't exist.

The closest example is this "raw" example:

https://github.com/kubernetes-client/javascript/blob/master/examples/raw-example.js

Which you could use, but you'll need to be able to figure out the right HTTP path from the object before hand.

@zfrhv
Copy link
Author

zfrhv commented Mar 4, 2024

i see
thank you

why not to implement the this feature then? it seems pretty easy to do.
just take the object api version and kind, and easily you have the uri needed, like kubectl

i think it will very simplify the usage of this tool

@brendandburns
Copy link
Contributor

We'd gladly take a PR implementing this if you want to send it.

@zfrhv
Copy link
Author

zfrhv commented Mar 5, 2024

alright, just so happens that i already did it ; )

i will create a seperate class called something like k8sApi instead of CoreV1Api sounds good?

it will take me few weeks tho, a little busy these days

@brendandburns
Copy link
Contributor

Sounds great! Perhaps GenericApi ?

@zfrhv
Copy link
Author

zfrhv commented Mar 6, 2024

neat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants