Any error in k8s is returned as 500 from magnum api

Bug #1495981 reported by Ryan Rossiter
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Magnum
Invalid
Undecided
Ryan Rossiter

Bug Description

To reproduce:

Bring up k8s bay

Run magnum pod-create --manifest ./redis-master.yaml --bay k8sbay
  - Change apiVersion to something that is not the api version being used

Expected Result:
Magnum API returns error message from Kubernetes as to why it failed

Actual Result:
Magnum API returns 'ERROR: 'NoneType' object has no attribute 'host' (HTTP 500)'

(Kubernetes returns: {u'status': u'Failure', u'kind': u'Status', u'code': 400, u'apiVersion': u'v1beta3', u'reason': u'BadRequest', u'message': u'Pod in version v1 cannot be handled as a Pod: no kind "Pod" is registered for version "v1"', u'metadata': {}})

In https://github.com/openstack/magnum/blob/master/magnum/conductor/handlers/k8s_conductor.py it looks like every k8s api call is wrapped in a try with an except on HTTPError. When k8s encounters any problem, it just puts the error in the response without raising an exception, so conductor keeps rolling assuming the call went OK. This results in the API returning 500 errors with very non-specific error messages.

These try blocks around k8s calls are for every operation in the k8s conductor handler, so any failure on those operations in k8s will result in a 500.

Ryan Rossiter (rlrossit)
Changed in magnum:
assignee: nobody → Ryan Rossiter (rlrossit)
Adrian Otto (aotto)
Changed in magnum:
milestone: none → mitaka-1
Changed in magnum:
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.