1

I added a v1/health_check endpoint to my service running on Openshift. The endpoint accepts all http verbs and returns what was in the request.

For example, running: curl -X DELETE -G 'http://localhost:8080/v1/health_check' -F "user_id=1" -F "build_category_id=14" -F "notification_type=slack" against the service when it is running locally returns:

{
  "endpoint": "/v1/health_check", 
  "form_data": {
    "build_category_id": "14", 
    "notification_type": "slack", 
    "user_id": "1"
  }, 
  "http_method": "DELETE", 
  "request_data": {}
}

When I use the same curl request against the service when it is running on Openshift, I get:

{
  "endpoint": "/v1/health_check", 
  "form_data": {}, 
  "http_method": "DELETE", 
  "request_data": {}
}

Does anyone have any ideas why the body of the DELETE methods are getting lost in Openshift?

Other notes:

  • It's a flask service using gevent.wsgi WSGIServer
  • I also acknowledge after some research that this isn't the most RESTful approach, especially after reading Is an entity body allowed for an HTTP DELETE request?
  • When I rsh onto the Openshift pod and curl the service, the endpoint works as expected, meaning the entity body goes through.
NateW
  • 2,856
  • 5
  • 26
  • 46
  • 1
    Try the curl request from inside of the pod for the application so you aren't going through the routing layer. Use ``oc rsh`` to get an interactive shell within the pod, or use the web console to get the terminal. – Graham Dumpleton Jul 04 '17 at 00:23
  • Great point! I have tried inside the Openshift node and the delete request is able to go through. – NateW Jul 05 '17 at 17:20
  • I think the http probes are limited to `GET` requests. Maybe try the using the command exec method instead, demonstrated in the [docs](https://docs.openshift.org/latest/dev_guide/application_health.html#container-health-checks-using-probes). – brennan Jul 05 '17 at 23:54
  • Hi @bren, my post isn't concerned with the http probes. – NateW Jul 05 '17 at 23:57
  • 1
    FWIW. The command exec method of doing probes is not really usable due to problems with Docker. Docker can't implement timeouts on commands. So be very careful using them as it may not give the desired results in failure cases. – Graham Dumpleton Jul 06 '17 at 03:33

1 Answers1

1

Don't use both -X DELETE and -G options. The -G options says to use HTTP GET. The -X DELETE says to use DELETE for the HTTP method.

My tests from MacOS X suggests that using both confuses curl, causing it to not actually send the request content.

$ curl -v --request DELETE -G --data xxx http://.../
*   Trying 52.87.56.37...
* Connected to ... (52.87.56.37) port 80 (#0)
> DELETE /?xxx HTTP/1.1
> Host: ...
> User-Agent: curl/7.43.0
> Accept: */*
>
< HTTP/1.1 200 OK
...
Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134