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

how to submit a yaml like kubectl create -f file.yaml ? #3336

Open
xiaoyu1095 opened this issue Apr 21, 2024 · 2 comments
Open

how to submit a yaml like kubectl create -f file.yaml ? #3336

xiaoyu1095 opened this issue Apr 21, 2024 · 2 comments
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.

Comments

@xiaoyu1095
Copy link

Is there a method to submit YAML resources of any type to Kubernetes ?
What I mean is not having to differentiate between Kind types.

@brendandburns
Copy link
Contributor

This is not currently possible. You would need to modify the Yaml class here:

https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/util/Yaml.java

To load unstructured YAML and then pick out the API group/version/kind and then use the ModelMapper here:
https://github.com/kubernetes-client/java/blob/master/util/src/main/java/io/kubernetes/client/util/ModelMapper.java

To determine the right strongly typed object, and then use Yaml.load again to reload the YAML into that strongly typed object.

Then you would need to pass that object to a GenericApi handler that was configured with the group/version/kind that you found above.

So it's possible, but it will require you to write a bunch of code. If you do, do that, feel free to send a PR.

@brendandburns brendandburns added the good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines. label Apr 21, 2024
@Ayush-Thakur-geek
Copy link

hey @brendandburns, i had a question.

So, do we need a feature that can differentiate between kinds without explicitly mentioning kinds in the yaml file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Denotes an issue ready for a new contributor, according to the "help wanted" guidelines.
Projects
None yet
Development

No branches or pull requests

3 participants