integ/python/python-kubernetes/centos/patches/0012-Fixes-kubernetes-client-python-issue-1047-ResponseNo.patch
Kyle MacLeod e2ab5cc2c8 Patch watch.py in python-kubernetes package
Patch the python2-kubernetes-8.0.0-8.el7.noarch.rpm with recent
bug fix commits required for proper kubernetes watch functionality.

Patches watch.py up to commit 10ae476 in the 'base' repo
(kubernetes-client/python-base).

Commits are taken from the cloned github repo, saved in patch format,
and applied as a patch to the source RPM.

Reference:
https://github.com/kubernetes-client/python-base/commits/master/watch/watch.py

This patch includes commits beginning with d56fdbc, up to and including 10ae476

Testing:
- Built and testing on local distributed cloud system
- Similar testing to this patch but  ased on locally modified package
  has been done on 1000 subcloud system
- Examine/compare contents of installed package vs. expected
- Generating events which trigger the watch conditions
- Monitor watches for proper behaviour on expiry

Story: 2008960
Task: 43053

Signed-off-by: Kyle MacLeod <kyle.macleod@windriver.com>
Change-Id: I7ad78957b6ef61e7204c45f482f201d5c281385b
2021-08-25 17:05:03 -04:00

32 lines
1.1 KiB
Diff

From 90399663f378b33227f723d3f0c1677965b6d96b Mon Sep 17 00:00:00 2001
From: Darren Hague <d.hague@sap.com>
Date: Thu, 8 Apr 2021 13:49:46 +0100
Subject: [PATCH 12/13] Fixes kubernetes-client/python issue 1047
"ResponseNotChunked from watch"
In recent versions of K8S (>1.16?), when a `Watch.stream()` call uses a
resource_version which is too old the resulting 410 error is wrapped in JSON
and returned in a non-chunked 200 response. Using `resp.stream()` instead of
`resp.read_chunked()` automatically handles the response being either chunked or
non-chunked.
---
watch/watch.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/watch/watch.py b/watch/watch.py
index b432778..3bbb770 100644
--- a/watch/watch.py
+++ b/watch/watch.py
@@ -53,7 +53,7 @@ def _find_return_type(func):
def iter_resp_lines(resp):
prev = ""
- for seg in resp.read_chunked(decode_content=False):
+ for seg in resp.stream(amt=None, decode_content=False):
if isinstance(seg, bytes):
seg = seg.decode('utf8')
seg = prev + seg
--
2.25.1