Merge branch 'kubernetes-client:master' into master

This commit is contained in:
xg0719 2022-07-07 19:59:24 +08:00 committed by GitHub
commit ab58e5cfc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 5 deletions

View File

@ -15,7 +15,6 @@
import time
import unittest
import uuid
import json
from kubernetes.e2e_test import base
from kubernetes.client import api_client
@ -527,9 +526,8 @@ class TestDynamicClient(unittest.TestCase):
'ports': [{'containerPort': 80,
'protocol': 'TCP'}]}]}}
body = json.dumps(pod_manifest).encode()
resp = api.server_side_apply(
name=name, namespace='default', body=body,
namespace='default', body=pod_manifest,
field_manager='kubernetes-unittests', dry_run="All")
self.assertEqual('kubernetes-unittests', resp.metadata.managedFields[0].manager)

View File

@ -157,7 +157,8 @@ 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 (re.search('json', headers['Content-Type'], re.IGNORECASE) or
headers['Content-Type'] == 'application/apply-patch+yaml'):
if headers['Content-Type'] == 'application/json-patch+json':
if not isinstance(body, list):
headers['Content-Type'] = \

View File

@ -5,7 +5,9 @@ index 65fbe95..e174317 100644
@@ -152,6 +152,10 @@ class RESTClientObject(object):
if query_params:
url += '?' + urlencode(query_params)
if re.search('json', headers['Content-Type'], re.IGNORECASE):
- if re.search('json', headers['Content-Type'], re.IGNORECASE):
+ if (re.search('json', headers['Content-Type'], re.IGNORECASE) or
+ headers['Content-Type'] == 'application/apply-patch+yaml'):
+ if headers['Content-Type'] == 'application/json-patch+json':
+ if not isinstance(body, list):
+ headers['Content-Type'] = \