Skip to content

Commit c7f60ed

Browse files
authored
Merge pull request #1584 from roycaihw/automated-release-of-19.15.0-upstream-release-19.0-1635134453
Generate v19.15.0 client
2 parents b6a5d53 + a66bb80 commit c7f60ed

17 files changed

+106
-46
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
strategy:
1010
matrix:
11-
python-version: [3.6, 3.7, 3.8, 3.9]
11+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1212

1313
steps:
1414
- uses: actions/checkout@v2

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# v19.15.0
2+
3+
Kubernetes API Version: v1.19.15
4+
5+
### Feature
6+
- The new parameter 'no_proxy' has been added to configuration for the REST and websocket client. ([kubernetes-client/python#1579](https://github.com/kubernetes-client/python/pull/1579), [@itaru2622](https://github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))//github.com/itaru2622))
7+
18
# v19.15.0b1
29

310
Kubernetes API Version: v1.19.15
@@ -12,6 +19,7 @@ Kubernetes API Version: v1.19.15
1219
- Type checking in `Client.serialize_body()` was made more restrictive and robust. ([kubernetes-client/python-base#241](https://github.com/kubernetes-client/python-base/pull/241), [@piglei](https://github.com/piglei))
1320

1421
### Feature
22+
- Support Proxy Authentication in websocket client(stream/ws_client) like REST client. ([kubernetes-client/python-base#256](https://github.com/kubernetes-client/python-base/pull/256), [@itaru2622](https://github.com/itaru2622))
1523
- Support for the dryRun parameter has been added to the dynamic client. ([kubernetes-client/python-base#247](https://github.com/kubernetes-client/python-base/pull/247), [@gravesm](https://github.com/gravesm))
1624

1725
### API Change

kubernetes/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ No description provided (generated by Openapi Generator https://github.com/opena
44
This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
55

66
- API version: release-1.19
7-
- Package version: 19.15.0b1
7+
- Package version: 19.15.0
88
- Build package: org.openapitools.codegen.languages.PythonClientCodegen
99

1010
## Requirements.

kubernetes/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
__project__ = 'kubernetes'
1616
# The version is auto-updated. Please do not edit.
17-
__version__ = "19.15.0b1"
17+
__version__ = "19.15.0"
1818

1919
import kubernetes.client
2020
import kubernetes.config

kubernetes/client/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515
from __future__ import absolute_import
1616

17-
__version__ = "19.15.0b1"
17+
__version__ = "19.15.0"
1818

1919
# import apis into sdk package
2020
from kubernetes.client.api.admissionregistration_api import AdmissionregistrationApi

kubernetes/client/api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7878
self.default_headers[header_name] = header_value
7979
self.cookie = cookie
8080
# Set default User-Agent.
81-
self.user_agent = 'OpenAPI-Generator/19.15.0b1/python'
81+
self.user_agent = 'OpenAPI-Generator/19.15.0/python'
8282
self.client_side_validation = configuration.client_side_validation
8383

8484
def __enter__(self):

kubernetes/client/configuration.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,9 @@ def __init__(self, host="http://localhost",
156156
self.proxy = None
157157
"""Proxy URL
158158
"""
159+
self.no_proxy = None
160+
"""bypass proxy for host in the no_proxy list.
161+
"""
159162
self.proxy_headers = None
160163
"""Proxy headers
161164
"""
@@ -347,7 +350,7 @@ def to_debug_report(self):
347350
"OS: {env}\n"\
348351
"Python Version: {pyversion}\n"\
349352
"Version of the API: release-1.19\n"\
350-
"SDK Package Version: 19.15.0b1".\
353+
"SDK Package Version: 19.15.0".\
351354
format(env=sys.platform, pyversion=sys.version)
352355

353356
def get_host_settings(self):

kubernetes/client/rest.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import urllib3
2626

2727
from kubernetes.client.exceptions import ApiException, ApiValueError
28+
from requests.utils import should_bypass_proxies
2829

2930

3031
logger = logging.getLogger(__name__)
@@ -83,7 +84,7 @@ def __init__(self, configuration, pools_size=4, maxsize=None):
8384
maxsize = 4
8485

8586
# https pool manager
86-
if configuration.proxy:
87+
if configuration.proxy and not should_bypass_proxies(configuration.host, no_proxy=configuration.no_proxy or ''):
8788
self.pool_manager = urllib3.ProxyManager(
8889
num_pools=pools_size,
8990
maxsize=maxsize,

kubernetes/e2e_test/test_batch.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ class TestClientBatch(unittest.TestCase):
2626
def setUpClass(cls):
2727
cls.config = base.get_e2e_configuration()
2828

29-
3029
def test_job_apis(self):
3130
client = api_client.ApiClient(configuration=self.config)
3231
api = batch_v1_api.BatchV1Api(client)
@@ -56,4 +55,4 @@ def test_job_apis(self):
5655
self.assertEqual(name, resp.metadata.name)
5756

5857
resp = api.delete_namespaced_job(
59-
name=name, body={}, namespace='default')
58+
name=name, namespace='default', propagation_policy='Background')

kubernetes/e2e_test/test_client.py

Lines changed: 40 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
else:
3636
import httplib
3737

38+
3839
def short_uuid():
3940
id = str(uuid.uuid4())
4041
return id[-12:]
@@ -60,6 +61,7 @@ def manifest_with_command(name, command):
6061
}
6162
}
6263

64+
6365
class TestClient(unittest.TestCase):
6466

6567
@classmethod
@@ -71,7 +73,8 @@ def test_pod_apis(self):
7173
api = core_v1_api.CoreV1Api(client)
7274

7375
name = 'busybox-test-' + short_uuid()
74-
pod_manifest = manifest_with_command(name, "while true;do date;sleep 5; done")
76+
pod_manifest = manifest_with_command(
77+
name, "while true;do date;sleep 5; done")
7578

7679
# wait for the default service account to be created
7780
timeout = time.time() + 30
@@ -84,9 +87,10 @@ def test_pod_apis(self):
8487
namespace='default')
8588
except ApiException as e:
8689
if (six.PY3 and e.status != HTTPStatus.NOT_FOUND) or (
87-
six.PY3 is False and e.status != httplib.NOT_FOUND):
90+
six.PY3 is False and e.status != httplib.NOT_FOUND):
8891
print('error: %s' % e)
89-
self.fail(msg="unexpected error getting default service account")
92+
self.fail(
93+
msg="unexpected error getting default service account")
9094
print('default service not found yet: %s' % e)
9195
time.sleep(1)
9296
continue
@@ -111,25 +115,25 @@ def test_pod_apis(self):
111115
'-c',
112116
'for i in $(seq 1 3); do date; done']
113117
resp = stream(api.connect_get_namespaced_pod_exec, name, 'default',
114-
command=exec_command,
115-
stderr=False, stdin=False,
116-
stdout=True, tty=False)
118+
command=exec_command,
119+
stderr=False, stdin=False,
120+
stdout=True, tty=False)
117121
print('EXEC response : %s' % resp)
118122
self.assertEqual(3, len(resp.splitlines()))
119123

120124
exec_command = 'uptime'
121125
resp = stream(api.connect_post_namespaced_pod_exec, name, 'default',
122-
command=exec_command,
123-
stderr=False, stdin=False,
124-
stdout=True, tty=False)
126+
command=exec_command,
127+
stderr=False, stdin=False,
128+
stdout=True, tty=False)
125129
print('EXEC response : %s' % resp)
126130
self.assertEqual(1, len(resp.splitlines()))
127131

128132
resp = stream(api.connect_post_namespaced_pod_exec, name, 'default',
129-
command='/bin/sh',
130-
stderr=True, stdin=True,
131-
stdout=True, tty=False,
132-
_preload_content=False)
133+
command='/bin/sh',
134+
stderr=True, stdin=True,
135+
stdout=True, tty=False,
136+
_preload_content=False)
133137
resp.write_stdin("echo test string 1\n")
134138
line = resp.readline_stdout(timeout=5)
135139
self.assertFalse(resp.peek_stderr())
@@ -157,7 +161,8 @@ def test_exit_code(self):
157161
api = core_v1_api.CoreV1Api(client)
158162

159163
name = 'busybox-test-' + short_uuid()
160-
pod_manifest = manifest_with_command(name, "while true;do date;sleep 5; done")
164+
pod_manifest = manifest_with_command(
165+
name, "while true;do date;sleep 5; done")
161166

162167
# wait for the default service account to be created
163168
timeout = time.time() + 30
@@ -171,9 +176,10 @@ def test_exit_code(self):
171176
namespace='default')
172177
except ApiException as e:
173178
if (six.PY3 and e.status != HTTPStatus.NOT_FOUND) or (
174-
six.PY3 is False and e.status != httplib.NOT_FOUND):
179+
six.PY3 is False and e.status != httplib.NOT_FOUND):
175180
print('error: %s' % e)
176-
self.fail(msg="unexpected error getting default service account")
181+
self.fail(
182+
msg="unexpected error getting default service account")
177183
print('default service not found yet: %s' % e)
178184
time.sleep(1)
179185
continue
@@ -201,11 +207,16 @@ def test_exit_code(self):
201207
(["/bin/sh", "-c", "ls /"], 0)
202208
)
203209
for command, value in commands_expected_values:
204-
client = stream(api.connect_get_namespaced_pod_exec, name, 'default',
205-
command=command,
206-
stderr=True, stdin=False,
207-
stdout=True, tty=False,
208-
_preload_content=False)
210+
client = stream(
211+
api.connect_get_namespaced_pod_exec,
212+
name,
213+
'default',
214+
command=command,
215+
stderr=True,
216+
stdin=False,
217+
stdout=True,
218+
tty=False,
219+
_preload_content=False)
209220

210221
self.assertIsNone(client.returncode)
211222
client.run_forever(timeout=10)
@@ -337,7 +348,8 @@ def test_portforward_raw(self):
337348

338349
for sock in (sock1234, sock1235):
339350
self.assertTrue(pf.connected)
340-
sent = b'Another test using fileno %s' % str(sock.fileno()).encode()
351+
sent = b'Another test using fileno %s' % str(
352+
sock.fileno()).encode()
341353
sock.sendall(sent)
342354
reply = b''
343355
while True:
@@ -361,7 +373,7 @@ def test_portforward_http(self):
361373
client = api_client.ApiClient(configuration=self.config)
362374
api = core_v1_api.CoreV1Api(client)
363375

364-
name = 'portforward-http-' + short_uuid()
376+
name = 'portforward-http-' + short_uuid()
365377
pod_manifest = {
366378
'apiVersion': 'v1',
367379
'kind': 'Pod',
@@ -404,7 +416,8 @@ def kubernetes_create_connection(address, *args, **kwargs):
404416
socket_create_connection = socket.create_connection
405417
try:
406418
socket.create_connection = kubernetes_create_connection
407-
response = urllib_request.urlopen('http://%s.default.kubernetes/' % name)
419+
response = urllib_request.urlopen(
420+
'http://%s.default.kubernetes/' % name)
408421
html = response.read().decode('utf-8')
409422
finally:
410423
socket.create_connection = socket_create_connection
@@ -485,7 +498,7 @@ def test_replication_controller_apis(self):
485498
self.assertEqual(2, resp.spec.replicas)
486499

487500
resp = api.delete_namespaced_replication_controller(
488-
name=name, body={}, namespace='default')
501+
name=name, namespace='default', propagation_policy='Background')
489502

490503
def test_configmap_apis(self):
491504
client = api_client.ApiClient(configuration=self.config)
@@ -521,7 +534,8 @@ def test_configmap_apis(self):
521534
resp = api.delete_namespaced_config_map(
522535
name=name, body={}, namespace='default')
523536

524-
resp = api.list_namespaced_config_map('default', pretty=True, label_selector="e2e-tests=true")
537+
resp = api.list_namespaced_config_map(
538+
'default', pretty=True, label_selector="e2e-tests=true")
525539
self.assertEqual([], resp.items)
526540

527541
def test_node_apis(self):

kubernetes/e2e_test/test_utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,9 @@ def setUpClass(cls):
3131
cls.test_namespace = "e2e-test-utils"
3232
k8s_client = client.api_client.ApiClient(configuration=cls.config)
3333
core_v1 = client.CoreV1Api(api_client=k8s_client)
34-
body = client.V1Namespace(metadata=client.V1ObjectMeta(name=cls.test_namespace))
34+
body = client.V1Namespace(
35+
metadata=client.V1ObjectMeta(
36+
name=cls.test_namespace))
3537
core_v1.create_namespace(body=body)
3638

3739
@classmethod
@@ -304,7 +306,7 @@ def test_create_from_multi_resource_yaml(self):
304306
name="mock", namespace="default")
305307
self.assertIsNotNone(ctr)
306308
core_api.delete_namespaced_replication_controller(
307-
name="mock", namespace="default", body={})
309+
name="mock", namespace="default", propagation_policy="Background")
308310
core_api.delete_namespaced_service(name="mock",
309311
namespace="default", body={})
310312

@@ -362,7 +364,7 @@ def test_create_from_multi_resource_yaml_with_conflict(self):
362364
name="mock-2", namespace="default")
363365
self.assertIsNotNone(ctr)
364366
core_api.delete_namespaced_replication_controller(
365-
name="mock-2", namespace="default", body={})
367+
name="mock-2", namespace="default", propagation_policy="Background")
366368
core_api.delete_namespaced_service(name="mock-2",
367369
namespace="default", body={})
368370

@@ -396,7 +398,7 @@ def test_create_from_multi_resource_yaml_with_multi_conflicts(self):
396398
def test_create_namespaced_apps_deployment_from_yaml(self):
397399
"""
398400
Should be able to create an apps/v1beta1 deployment
399-
in a test namespace.
401+
in a test namespace.
400402
"""
401403
k8s_client = client.api_client.ApiClient(configuration=self.config)
402404
utils.create_from_yaml(

kubernetes/test/test_api_client.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import unittest
77

88
import kubernetes
9-
9+
from kubernetes.client.configuration import Configuration
10+
import urllib3
1011

1112
class TestApiClient(unittest.TestCase):
1213

@@ -23,3 +24,28 @@ def test_atexit_closes_threadpool(self):
2324
self.assertIsNotNone(client._pool)
2425
atexit._run_exitfuncs()
2526
self.assertIsNone(client._pool)
27+
28+
def test_rest_proxycare(self):
29+
30+
pool = { 'proxy': urllib3.ProxyManager, 'direct': urllib3.PoolManager }
31+
32+
for dst, proxy, no_proxy, expected_pool in [
33+
( 'http://kube.local/', None, None, pool['direct']),
34+
( 'http://kube.local/', 'http://proxy.local:8080/', None, pool['proxy']),
35+
( 'http://127.0.0.1:8080/', 'http://proxy.local:8080/', 'localhost,127.0.0.0/8,.local', pool['direct']),
36+
( 'http://kube.local/', 'http://proxy.local:8080/', 'localhost,127.0.0.0/8,.local', pool['direct']),
37+
( 'http://kube.others.com:1234/','http://proxy.local:8080/', 'localhost,127.0.0.0/8,.local', pool['proxy']),
38+
( 'http://kube.others.com:1234/','http://proxy.local:8080/', '*', pool['direct']),
39+
]:
40+
# setup input
41+
config = Configuration()
42+
setattr(config, 'host', dst)
43+
if proxy is not None:
44+
setattr(config, 'proxy', proxy)
45+
if no_proxy is not None:
46+
setattr(config, 'no_proxy', no_proxy)
47+
# setup done
48+
49+
# test
50+
client = kubernetes.client.ApiClient(configuration=config)
51+
self.assertEqual( expected_pool, type(client.rest_client.pool_manager) )

scripts/constants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
KUBERNETES_BRANCH = "release-1.19"
1919

2020
# client version for packaging and releasing.
21-
CLIENT_VERSION = "19.15.0b1"
21+
CLIENT_VERSION = "19.15.0"
2222

2323
# Name of the release package
2424
PACKAGE_NAME = "kubernetes"
2525

2626
# Stage of development, mainly used in setup.py's classifiers.
27-
DEVELOPMENT_STATUS = "4 - Beta"
27+
DEVELOPMENT_STATUS = "5 - Production/Stable"
2828

2929

3030
# If called directly, return the constant value given

scripts/release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
# - add a sentence about "changes since {last release}". In most cases our
5757
# releases should be sequential. This script (the workflow above) is based on
5858
# this assumption, and we should make the release note clear about that.
59+
# - update readme; if it's a real release (instead of a snapshot in master
60+
# branch), also create a PR to update changelog and readme in the master
61+
# branch
5962
#
6063
# Usage:
6164
# $ KUBERNETES_BRANCH=release-1.19 CLIENT_VERSION=19.0.0-snapshot DEVELOPMENT_STATUS="3 - Alpha" scripts/release.sh
@@ -64,6 +67,9 @@ set -o errexit
6467
set -o nounset
6568
set -o pipefail
6669

70+
# used by the client generator: https://github.com/kubernetes-client/gen/blob/729332ad08f0f4d98983b7beb027e2f657236ef9/openapi/openapi-generator/client-generator.sh#L52
71+
export USERNAME=kubernetes
72+
6773
repo_root="$(git rev-parse --show-toplevel)"
6874
declare -r repo_root
6975
cd "${repo_root}"

0 commit comments

Comments
 (0)