Skip to content
3 changes: 1 addition & 2 deletions cli/cmd/lib_cli_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down
6 changes: 3 additions & 3 deletions manager/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions pkg/operator/endpoints/respond.go
Original file line number Diff line number Diff line change
Expand Up @@ -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...)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/operator/endpoints/verify_cortex.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ import (
)

func VerifyCortex(w http.ResponseWriter, r *http.Request) {
respond(w, "ok")
respondPlainText(w, "ok")
}