def setUpClass(cls): super(TestKubernetesAPIs, cls).setUpClass() cls.baymodel = cls._create_baymodel('testk8sAPI') cls.bay = cls._create_bay('testk8sAPI', cls.baymodel.uuid) kube_api_address = cls.cs.bays.get(cls.bay.uuid).api_address kube_api_url = 'http://%s' % kube_api_address k8s_client = swagger.ApiClient(kube_api_url) cls.k8s_api = ApivbetaApi.ApivbetaApi(k8s_client)
def __init__(self, context, obj): # retrieve the URL of the k8s API endpoint k8s_api_endpoint = self._retrieve_k8s_api_endpoint(context, obj) # build a connection with Kubernetes master client = swagger.ApiClient(k8s_api_endpoint) super(K8sAPI, self).__init__(client)