Namespaces Management/vSphere with Kubernetes client initialisation

This post was originally published on this site

Hello All,

   Based on the documentation to create a client to vCenter server is done using create_vsphere_client helper function. The problem is that this Helper function doesn’t seem to provide methods for all the vSphere Automation REST API, like Namespaces Managmement client documented under – https://vmware.github.io/vsphere-automation-sdk-python/vsphere/7.0.0.1/com.vmware.vcenter.html#module-com.vmware.vcenter.namespace_management_client.

   My question is what is the best way to initilise the “stubs” for this endpoint and use the functionlity to manage Kubernetes in vSphere 7.0

   Also is there documentation on how to properly initialise additional stubs if they are not part of the helper function?

 

P.S.

I’ve managed to overcome this by accessing some of the private properties of VsphereClient class. Something in the line of:

from com.vmware.vcenter.namespace_management_client import StubFactory
from vmware.vapi.vsphere.client import create_vsphere_client
vsphere_client = create_vsphere_client(server=‘<vc_ip>’, username=‘<vc_username>’, password=‘<vc_password>’, session=session)
namespaces_management_client = StubFactory(vsphere_client.session_svc._config)

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.