ManageIQ/kubeclient

Ability to obtain related client for different api group/version from existing client

cben opened this issue · 0 comments

cben commented

overview of alternatives: #208 (comment)

(Originally mentioned in #329 (comment))
A way to reduce multi-api-group pain (#208) that would be easy to implement, not sure if best long-term:

Add a method on a client that returns a "related" client, same cluster same settings just different api group. Something like:

client = Kubeclient::Client.new('http://localhost:8080/', 'v1')
client.get_service_accounts

client.for_group('rbac.authorization.k8s.io/v1').get_role_bindings

This way the group/version of the client you originally got doesn't matter, you can derive one that you need.

Ideally the overhead would be low. Memory for settings can be shared. Discovery can be cached, e.g. all related clients can share a {group => client} hash and only construct new one if not yet known.