diff --git a/cli/cmd/lib_cli_config.go b/cli/cmd/lib_cli_config.go index 1e6b0b0047..ead82f1758 100644 --- a/cli/cmd/lib_cli_config.go +++ b/cli/cmd/lib_cli_config.go @@ -499,18 +499,17 @@ func validateOperatorEndpoint(endpoint string) (string, error) { if err != nil { return "", errors.Wrap(err, "verifying operator endpoint", url) } - req.Header.Set("Content-Type", "application/json") client := http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, }, } + response, err := client.Do(req) if err != nil { return "", ErrorInvalidOperatorEndpoint(url) } - if response.StatusCode != 200 { return "", ErrorInvalidOperatorEndpoint(url) } diff --git a/manager/install.sh b/manager/install.sh index b6059841e2..3d9eb5522c 100755 --- a/manager/install.sh +++ b/manager/install.sh @@ -442,8 +442,8 @@ function validate_cortex() { echo "operator endpoint reachable: $operator_endpoint_reachable" fi if [ "$operator_endpoint" != "" ]; then - echo "operator curl response (404 is expected):" - curl --max-time 3 $operator_endpoint + echo "operator curl response:" + curl --max-time 3 "${operator_endpoint}/verifycortex" fi echo exit 1 @@ -493,7 +493,7 @@ function validate_cortex() { if [ "$CORTEX_OPERATOR_LOAD_BALANCER_SCHEME" == "internet-facing" ]; then if [ "$operator_endpoint_reachable" != "true" ]; then - if ! curl --max-time 3 $operator_endpoint >/dev/null 2>&1; then + if ! curl --max-time 3 "${operator_endpoint}/verifycortex" >/dev/null 2>&1; then continue fi operator_endpoint_reachable="true" diff --git a/pkg/operator/endpoints/respond.go b/pkg/operator/endpoints/respond.go index 29033f4990..aa1d9e5f21 100644 --- a/pkg/operator/endpoints/respond.go +++ b/pkg/operator/endpoints/respond.go @@ -31,6 +31,12 @@ func respond(w http.ResponseWriter, response interface{}) { json.NewEncoder(w).Encode(response) } +func respondPlainText(w http.ResponseWriter, response string) { + w.Header().Set("Content-Type", "text/plain") + w.WriteHeader(http.StatusOK) + w.Write([]byte(response)) +} + func respondError(w http.ResponseWriter, r *http.Request, err error, strs ...string) { respondErrorCode(w, r, http.StatusBadRequest, err, strs...) } diff --git a/pkg/operator/endpoints/verify_cortex.go b/pkg/operator/endpoints/verify_cortex.go index e3b86409f8..6972a13997 100644 --- a/pkg/operator/endpoints/verify_cortex.go +++ b/pkg/operator/endpoints/verify_cortex.go @@ -21,5 +21,5 @@ import ( ) func VerifyCortex(w http.ResponseWriter, r *http.Request) { - respond(w, "ok") + respondPlainText(w, "ok") }