func pollConfigz(timeout time.Duration, pollInterval time.Duration, nodeName, namespace string, useProxy bool) *http.Response {
	endpoint := ""
	if useProxy {
		// start local proxy, so we can send graceful deletion over query string, rather than body parameter
		framework.Logf("Opening proxy to cluster")
		tk := e2ekubectl.NewTestKubeconfig(framework.TestContext.CertDir, framework.TestContext.Host, framework.TestContext.KubeConfig, framework.TestContext.KubeContext, framework.TestContext.KubectlPath, namespace)
		cmd := tk.KubectlCmd("proxy", "-p", "0")
		stdout, stderr, err := framework.StartCmdAndStreamOutput(cmd)
		framework.ExpectNoError(err)
		defer stdout.Close()
		defer stderr.Close()
		defer framework.TryKill(cmd)

		buf := make([]byte, 128)
		var n int
		n, err = stdout.Read(buf)
		framework.ExpectNoError(err)
		output := string(buf[:n])
		proxyRegexp := regexp.MustCompile("Starting to serve on 127.0.0.1:([0-9]+)")
		match := proxyRegexp.FindStringSubmatch(output)
		framework.ExpectEqual(len(match), 2)
		port, err := strconv.Atoi(match[1])
		framework.ExpectNoError(err)
		framework.Logf("http requesting node kubelet /configz")
		endpoint = fmt.Sprintf("http://127.0.0.1:%d/api/v1/nodes/%s/proxy/configz", port, nodeName)
	} else {
		endpoint = fmt.Sprintf("http://127.0.0.1:8080/api/v1/nodes/%s/proxy/configz", framework.TestContext.NodeName)
	}
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}
	req, err := http.NewRequest("GET", endpoint, nil)
	framework.ExpectNoError(err)
	req.Header.Add("Accept", "application/json")

	var resp *http.Response
	wait.PollImmediate(pollInterval, timeout, func() (bool, error) {
		resp, err = client.Do(req)
		if err != nil {
			framework.Logf("Failed to get /configz, retrying. Error: %v", err)
			return false, nil
		}
		if resp.StatusCode != 200 {
			framework.Logf("/configz response status not 200, retrying. Response was: %+v", resp)
			return false, nil
		}

		return true, nil
	})
	return resp
}
// returns a status 200 response from the /configz endpoint or nil if fails
returns a status 200 response from the /configz endpoint or nil if fails
// returns a status 200 response from the / configz endpoint or nil if fails
func pollConfigz(timeout time.Duration, pollInterval time.Duration, nodeName, namespace string, useProxy bool) *http.Response {
	endpoint := ""
	if useProxy {
		framework.Logf("Opening proxy to cluster")
		tk := e2ekubectl.NewTestKubeconfig(framework.TestContext.CertDir, framework.TestContext.Host, framework.TestContext.KubeConfig, framework.TestContext.KubeContext, framework.TestContext.KubectlPath, namespace)
		cmd := tk.KubectlCmd("proxy", "-p", "0")
		stdout, stderr, err := framework.StartCmdAndStreamOutput(cmd)
		framework.ExpectNoError(err)
		defer stdout.Close()
		defer stderr.Close()
		defer framework.TryKill(cmd)
		buf := make([]byte, 128)
		var n int
		n, err = stdout.Read(buf)
		framework.ExpectNoError(err)
		output := string(buf[:n])
		proxyRegexp := regexp.MustCompile("Starting to serve on 127.0.0.1:([0-9]+)")
		match := proxyRegexp.FindStringSubmatch(output)
		framework.ExpectEqual(len(match), 2)
		port, err := strconv.Atoi(match[1])
		framework.ExpectNoError(err)
		framework.Logf("http requesting node kubelet /configz")
		endpoint = fmt.Sprintf("http://127.0.0.1:%d/api/v1/nodes/%s/proxy/configz", port, nodeName)
	} else {
		endpoint = fmt.Sprintf("http://127.0.0.1:8080/api/v1/nodes/%s/proxy/configz", framework.TestContext.NodeName)
	}
	tr := &http.Transport{
		TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	}
	client := &http.Client{Transport: tr}
	req, err := http.NewRequest("GET", endpoint, nil)
	framework.ExpectNoError(err)
	req.Header.Add("Accept", "application/json")
	var resp *http.Response
	wait.PollImmediate(pollInterval, timeout, func() (bool, error) {
		resp, err = client.Do(req)
		if err != nil {
			framework.Logf("Failed to get /configz, retrying. Error: %v", err)
			return false, nil
		}
		if resp.StatusCode != 200 {
			framework.Logf("/configz response status not 200, retrying. Response was: %+v", resp)
			return false, nil
		}
		return true, nil
	})
	return resp
}
func pollConfigz ( timeout time . Duration , pollInterval time . Duration , nodeName , namespace string , useProxy bool ) * http . Response { endpoint := " " if useProxy { framework . Logf ( " " ) tk := e2ekubectl . NewTestKubeconfig ( framework . TestContext . CertDir , framework . TestContext . Host , framework . TestContext . KubeConfig , framework . TestContext . KubeContext , framework . TestContext . KubectlPath , namespace ) cmd := tk . KubectlCmd ( " " , " " , " " ) stdout , stderr , err := framework . StartCmdAndStreamOutput ( cmd ) framework . ExpectNoError ( err ) defer stdout . Close ( ) defer stderr . Close ( ) defer framework . TryKill ( cmd ) buf := make ( [ ] byte , 128 ) var n int n , err = stdout . Read ( buf ) framework . ExpectNoError ( err ) output := string ( buf [ : n ] ) proxyRegexp := regexp . MustCompile ( " " ) match := proxyRegexp . FindStringSubmatch ( output ) framework . ExpectEqual ( len ( match ) , 2 ) port , err := strconv . Atoi ( match [ 1 ] ) framework . ExpectNoError ( err ) framework . Logf ( " " ) endpoint = fmt . Sprintf ( " " , port , nodeName ) } else { endpoint = fmt . Sprintf ( " " , framework . TestContext . NodeName ) } tr := & http . Transport { TLSClientConfig : & tls . Config { InsecureSkipVerify : true } , } client := & http . Client { Transport : tr } req , err := http . NewRequest ( " " , endpoint , nil ) framework . ExpectNoError ( err ) req . Header . Add ( " " , " " ) var resp * http . Response wait . PollImmediate ( pollInterval , timeout , func ( ) ( bool , error ) { resp , err = client . Do ( req ) if err != nil { framework . Logf ( " " , err ) return false , nil } if resp . StatusCode != 200 { framework . Logf ( " " , resp ) return false , nil } return true , nil } ) return resp }
returns a status 200 response from the /configz endpoint or nil if fails
returns a status 200 response from the / configz endpoint or nil if fails
// start local proxy, so we can send graceful deletion over query string, rather than body parameter