From 0bb4433a0dda5a39e50ff742c323a75036215ebc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Wcis=C5=82o?= <33344684+m-wcislo@users.noreply.github.com> Date: Mon, 19 Dec 2022 10:30:12 +0100 Subject: [PATCH] Revert "fix disabling cert validation (#124)" This reverts commit a1c5dd091543c49c87de6babc85f62fa42e5194c. --- CHANGELOG.md | 6 ------ src/KubeLibrary/KubeLibrary.py | 3 ++- src/KubeLibrary/version.py | 2 +- test/test_KubeLibrary.py | 3 ++- 4 files changed, 5 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8800dd..b7b2f42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,14 +5,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/) and this project adheres to [Semantic Versioning](http://semver.org/). ## In progress - -## [0.8.1] - 2022-12-16 -### Added - Add proxy configuration fetched from `HTTP_PROXY` or `http_proxy` environment variable -### Fixed -Fix disabling cert validation [#124](https://github.com/devopsspiral/KubeLibrary/pull/124) - ## [0.8.0] - 2022-10-27 ### Added - Add function list_namespaced_stateful_set_by_pattern [#114](https://github.com/devopsspiral/KubeLibrary/pull/113) by [@siaomingjeng](https://github.com/siaomingjeng) diff --git a/src/KubeLibrary/KubeLibrary.py b/src/KubeLibrary/KubeLibrary.py index ebff896..3f73adc 100755 --- a/src/KubeLibrary/KubeLibrary.py +++ b/src/KubeLibrary/KubeLibrary.py @@ -1,5 +1,6 @@ import json import re +import ssl import urllib3 from os import environ @@ -275,7 +276,7 @@ def reload_config(self, kube_config=None, context=None, api_url=None, bearer_tok def _add_api(self, reference, class_name): self.__dict__[reference] = class_name(self.api_client) if not self.cert_validation: - self.__dict__[reference].api_client.configuration.verify_ssl = False + self.__dict__[reference].api_client.rest_client.pool_manager.connection_pool_kw['cert_reqs'] = ssl.CERT_NONE def k8s_api_ping(self): """Performs GET on /api/v1/ for simple check of API availability. diff --git a/src/KubeLibrary/version.py b/src/KubeLibrary/version.py index 73baf8f..8675559 100644 --- a/src/KubeLibrary/version.py +++ b/src/KubeLibrary/version.py @@ -1 +1 @@ -version = "0.8.1" +version = "0.8.0" diff --git a/test/test_KubeLibrary.py b/test/test_KubeLibrary.py index 7cae67e..b99291b 100644 --- a/test/test_KubeLibrary.py +++ b/test/test_KubeLibrary.py @@ -1,6 +1,7 @@ import json import mock import re +import ssl import unittest from KubeLibrary import KubeLibrary from KubeLibrary.exceptions import BearerTokenWithPrefixException @@ -305,7 +306,7 @@ def test_KubeLibrary_inits_without_cert_validation(self): kl = KubeLibrary(kube_config='test/resources/k3d', cert_validation=False) for api in TestKubeLibrary.apis: target = getattr(kl, api) - self.assertEqual(target.api_client.configuration.verify_ssl, False) + self.assertEqual(target.api_client.rest_client.pool_manager.connection_pool_kw['cert_reqs'], ssl.CERT_NONE) @responses.activate def test_KubeLibrary_inits_with_bearer_token(self):