(kubelet_url, cadvisor_port)
return url
Tries to connect to the cadvisor endpoint, with given params
        :return: url if OK, raises exception if NOK
Tries to connect to the cadvisor endpoint, with given params
        :return: url if OK, raises exception if NOK
Tries to connect to the cadvisor endpoint with given params : return : url if OK raises exception if NOK
def detect_cadvisor(kubelet_url, cadvisor_port):
        """
        Tries to connect to the cadvisor endpoint, with given params
        :return: url if OK, raises exception if NOK
        """
        if cadvisor_port == 0:
            raise ValueError("cAdvisor port set to 0 in configuration")
        kubelet_hostname = urlparse(kubelet_url).hostname
        if not kubelet_hostname:
            raise ValueError("kubelet hostname empty")
        url = "http://{}:{}{}".format(kubelet_hostname, cadvisor_port, LEGACY_CADVISOR_METRICS_PATH)

        # Test the endpoint is present
        r = requests.head(url, timeout=1)
        r.raise_for_status()

        return url
def detect_cadvisor ( kubelet_url , cadvisor_port ) : if cadvisor_port == 0 : raise ValueError ( "cAdvisor port set to 0 in configuration" ) kubelet_hostname = urlparse ( kubelet_url ) . hostname if not kubelet_hostname : raise ValueError ( "kubelet hostname empty" ) url = "http://{}:{}{}" . format ( kubelet_hostname , cadvisor_port , LEGACY_CADVISOR_METRICS_PATH ) # Test the endpoint is present r = requests . head ( url , timeout = 1 ) r . raise_for_status ( ) return url