Skip to content

Commit

Permalink
fix disabling cert validation (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-wcislo authored Dec 16, 2022
1 parent 7f4037c commit a1c5dd0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 1 addition & 2 deletions src/KubeLibrary/KubeLibrary.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import json
import re
import ssl
import urllib3

from os import environ
Expand Down Expand Up @@ -276,7 +275,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.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.
Expand Down
2 changes: 1 addition & 1 deletion src/KubeLibrary/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "0.8.0"
version = "0.8.1"
3 changes: 1 addition & 2 deletions test/test_KubeLibrary.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import json
import mock
import re
import ssl
import unittest
from KubeLibrary import KubeLibrary
from KubeLibrary.exceptions import BearerTokenWithPrefixException
Expand Down Expand Up @@ -306,7 +305,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.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):
Expand Down

0 comments on commit a1c5dd0

Please sign in to comment.