Пример #1
0
 def refresh_connection(self):
     """
     Login into OCP, refresh endpoint and token.
     """
     ocp = OCP(kind=constants.ROUTE,
               namespace=defaults.OCS_MONITORING_NAMESPACE)
     assert ocp.login(self._user, self._password), 'Login to OCP failed'
     self._token = ocp.get_user_token()
     route_obj = ocp.get(resource_name=defaults.PROMETHEUS_ROUTE)
     self._endpoint = 'https://' + route_obj['spec']['host']
Пример #2
0
 def refresh_connection(self):
     """
     Login into OCP, refresh endpoint and token.
     """
     ocp = OCP(kind=constants.ROUTE, namespace=defaults.OCS_MONITORING_NAMESPACE)
     kubeconfig = os.getenv("KUBECONFIG")
     kube_data = ""
     with open(kubeconfig, "r") as kube_file:
         kube_data = kube_file.readlines()
     assert ocp.login(self._user, self._password), "Login to OCP failed"
     self._token = ocp.get_user_token()
     with open(kubeconfig, "w") as kube_file:
         kube_file.writelines(kube_data)
     route_obj = ocp.get(resource_name=defaults.PROMETHEUS_ROUTE)
     self._endpoint = "https://" + route_obj["spec"]["host"]