Repository: kubernetes-client/python
Issue: What needs to be done to get patch_namespaced_deployment to work?

I want to update the image for one of my containers in a deployment and it seems I can't provide an UnversionedPatch. Using a valid JSON patch string, or the strategic-merge string I use in kubectl ends up with variations of 
```HTTP response body: {"kind":"Status","apiVersion":"v1","metadata":{},"status":"Failure","message":"json: cannot unmarshal string into Go value of type jsonpatch.Patch","code":500}```

Am I doing something wrong or is this not implemented yet? The link to UnversionedPatch returns a 404 https://github.com/kubernetes-incubator/client-python/blob/master/kubernetes/docs/UnversionedPatch.md If it's not implemented I'd be happy to work on it.

Changed files:
kubernetes/e2e_test/test_client.py, kubernetes/client/rest.py

diff --git a/kubernetes/client/rest.py b/kubernetes/client/rest.py
index 58cc988f4..2683b8f90 100644
--- a/kubernetes/client/rest.py
+++ b/kubernetes/client/rest.py
@@ -146,7 +146,18 @@ class RESTClientObject(object):
             if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']:
                 if query_params:
                     url += '?' + urlencode(query_params)
-                if re.search('json', headers['Content-Type'], re.IGNORECASE):
+                if headers['Content-Type'] == 'application/json-patch+json':
+                    headers[
+                        'Content-Type'] = 'application/strategic-merge-patch+json'
+                    request_body = None
+                    if body:
+                        request_body = json.dumps(body)
+                    r = self.pool_manager.request(method, url,
+                                                  body=request_body,
+                                                  preload_content=_preload_content,
+                                                  timeout=timeout,
+                                                  headers=headers)
+                elif re.search('json', headers['Content-Type'], re.IGNORECASE):
                     request_body = None
                     if body:
                         request_body = json.dumps(body)
diff --git a/kubernetes/e2e_test/test_client.py b/kubernetes/e2e_test/test_client.py
index d66949c81..e23cf0c48 100644
--- a/kubernetes/e2e_test/test_client.py
+++ b/kubernetes/e2e_test/test_client.py
@@ -105,17 +105,15 @@ class TestClient(unittest.TestCase):
         self.assertEqual('frontend', resp.metadata.name)
         self.assertTrue(resp.status)
 
-        # TODO(dims) : Fails with "json: cannot unmarshal object into
-        # Go value of type jsonpatch.Patch"
-        # service_manifest['spec']['ports'] = [{'name': 'new',
-        #                                       'port': 8080,
-        #                                       'protocol': 'TCP',
-        #                                       'targetPort': 8080}]
-        # resp = api.patch_namespaced_service(body=service_manifest,
-        #                                     name='frontend',
-        #                                     namespace='default')
-        # self.assertEqual(2, len(resp.spec.ports))
-        # self.assertTrue(resp.status)
+        service_manifest['spec']['ports'] = [{'name': 'new',
+                                              'port': 8080,
+                                              'protocol': 'TCP',
+                                              'targetPort': 8080}]
+        resp = api.patch_namespaced_service(body=service_manifest,
+                                            name='frontend',
+                                            namespace='default')
+        self.assertEqual(2, len(resp.spec.ports))
+        self.assertTrue(resp.status)
 
         resp = api.delete_namespaced_service(name='frontend',
                                              namespace='default')
@@ -182,11 +180,9 @@ class TestClient(unittest.TestCase):
             name='test-configmap', namespace='default')
         self.assertEqual('test-configmap', resp.metadata.name)
 
-        # TODO(dims): Fails with "json: cannot unmarshal object
-        # into Go value of type jsonpatch.Patch"
-        # test_configmap['data']['config.json'] = "{}"
-        # resp = api.patch_namespaced_config_map(
-        #     name='test-configmap', namespace='default', body=test_configmap)
+        test_configmap['data']['config.json'] = "{}"
+        resp = api.patch_namespaced_config_map(
+            name='test-configmap', namespace='default', body=test_configmap)
 
         resp = api.delete_namespaced_config_map(
             name='test-configmap', body={}, namespace='default')