Created
February 5, 2019 17:57
-
-
Save jsanda/fee693cfbd761a348bcef66e2628588d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ... | |
} else { // Active=False | |
url := fmt.Sprintf("http://%s.%s", pa.Spec.ServiceName, pa.ObjectMeta.Namespace) | |
client := &http.Client{} | |
req, _ := http.NewRequest("GET", url, nil) | |
req.Header.Set("knative-activator-probe", "true") | |
resp, err := client.Do(req) | |
if err != nil { | |
logger.Errorf("Probe request to %s failed", url, zap.Error(err)) | |
return desiredScale, err | |
} | |
if resp.StatusCode != http.StatusOK { | |
return desiredScale, nil | |
} | |
body, err := ioutil.ReadAll(resp.Body) | |
if err != nil { | |
logger.Errorf("Failed to read response from probe request to %s", url, err) | |
return desiredScale, nil | |
} | |
if string(body) == "queue-proxy" { | |
return desiredScale, nil | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment