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

Automatically detect kind and apiVersion in Resources #235

Closed
danajp opened this issue Mar 13, 2017 · 2 comments
Closed

Automatically detect kind and apiVersion in Resources #235

danajp opened this issue Mar 13, 2017 · 2 comments

Comments

@danajp
Copy link

danajp commented Mar 13, 2017

So I've found myself writing a lot of code like this lately:

kube_url = 'https://k8s.example.com'
core_client = Kubeclient::Client.new(kube_url, 'v1', :ssl_options => some_ssl_options)
ext_client = Kubeclient::Client.new(kube_url, 'apis/extensions/v1beta1', :ssl_options => some_ssl_options)
batch_client = Kubeclient::Client.new(kube_url, 'apis/batch/v1', :ssl_options => some_ssl_options)

And then I have to decide which client instance to use depending on the kind of entity I'm working with. The core client for services, ext client for deployments, batch client for jobs, etc. It'd be nice if this worked like kubectl apply -f some-entity.yml where I could specify the kind and apiVersion fields in my Kubeclient::Resource object and have the client instance figure out which api endpoint to use:

deployment = Kubeclient::Resource.new(
  :kind => 'Deployment',
  :apiVersion => 'extensions/v1beta1',
  # ...
)
service = Kubeclient::Resource.new(
  :kind => 'Service',
  :apiVersion => 'v1',
  # ...
)

client.create_entity(deployment)
client.create_entity(service)

I'm considering writing a wrapper to implement this, but I'd much rather modify kubeclient and contribute those changes upstream instead. Is this something the project would be interested in?

@simon3z
Copy link
Collaborator

simon3z commented Mar 13, 2017

@danajp is this a duplicate of #208 ?

@danajp
Copy link
Author

danajp commented Mar 13, 2017

Yep, my issue search-fu is weak. I'll close this. Thanks!

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