Repository: devopsspiral/KubeLibrary

Issue:
certificate verify failed issue when using Get Namespaced Pod Exec
When using the Get Namespaced Pod Exec keywork on a k8s cluster using a custom CA, the following error occurs :
```
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get issuer certificate (_ssl.c:1129)
```

Other keywords (Read Namespaced Pod Status, List Namespaced Pod By Pattern ...) are working as expected.

As a quick fix, I'm adding the following line in the _add_api method of the library :
```
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.rest_client.pool_manager.connection_pool_kw['cert_reqs'] = ssl.CERT_NONE
        self.__dict__[reference].api_client.configuration.verify_ssl = False
```

Am I missing something regarding the library configuration ?

Versions : 
```
KubeLibrary: 0.8.0
Python: 3.9.13
Kubernetes: 1.24
```

KubeLibrary : 
```
Library    KubeLibrary    kube_config=${KUBECONFIG_FILE}    cert_validation=False

KubeLibrary.Get Namespaced Pod Exec    
...    name=my-pod
...    namespace=${namespace}
...    argv_cmd=${command}
```

Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7b2f42..e8800dd 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,8 +5,14 @@ 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 3f73adc..ebff896 100755
--- a/src/KubeLibrary/KubeLibrary.py
+++ b/src/KubeLibrary/KubeLibrary.py
@@ -1,6 +1,5 @@
 import json
 import re
-import ssl
 import urllib3
 
 from os import environ
@@ -276,7 +275,7 @@ class KubeLibrary:
     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.rest_client.pool_manager.connection_pool_kw['cert_reqs'] = ssl.CERT_NONE
+            self.__dict__[reference].api_client.configuration.verify_ssl = False
 
     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 8675559..73baf8f 100644
--- a/src/KubeLibrary/version.py
+++ b/src/KubeLibrary/version.py
@@ -1,1 +1,1 @@
-version = "0.8.0"
+version = "0.8.1"


Test patch:
diff --git a/test/test_KubeLibrary.py b/test/test_KubeLibrary.py
index b99291b..7cae67e 100644
--- a/test/test_KubeLibrary.py
+++ b/test/test_KubeLibrary.py
@@ -1,7 +1,6 @@
 import json
 import mock
 import re
-import ssl
 import unittest
 from KubeLibrary import KubeLibrary
 from KubeLibrary.exceptions import BearerTokenWithPrefixException
@@ -306,7 +305,7 @@ class TestKubeLibrary(unittest.TestCase):
         kl = KubeLibrary(kube_config='test/resources/k3d', cert_validation=False)
         for api in TestKubeLibrary.apis:
             target = getattr(kl, api)
-            self.assertEqual(target.api_client.rest_client.pool_manager.connection_pool_kw['cert_reqs'], ssl.CERT_NONE)
+            self.assertEqual(target.api_client.configuration.verify_ssl, False)
 
     @responses.activate
     def test_KubeLibrary_inits_with_bearer_token(self):