-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ensure k8s config compatibility with kubernetes==12 python client + support proxies #73
Conversation
…ty with the v12 python client (fixes hellofresh#72)
Codecov Report
@@ Coverage Diff @@
## master #73 +/- ##
==========================================
+ Coverage 32.84% 35.65% +2.80%
==========================================
Files 9 9
Lines 618 603 -15
==========================================
+ Hits 203 215 +12
+ Misses 415 388 -27
Continue to review full report at Codecov.
|
kubernetes~=10.0.1 | ||
python-dotenv~=0.10.2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed these because they are duplicated by requirements.txt
; both of which are installed to run tests in the Makefile; making it easier to switch versions when running unit tests.
a2f1a6f
to
25eb000
Compare
…xy to route traffic through. Note that this will only work with a TLS passthrough proxy anyway; since the TLS connections will fail cert validation otherwise.
25eb000
to
5694dfb
Compare
@chadlwilson Thanks for the contribution |
You're welcome - thanks for keeping on top of the PRs @crhuber ! |
Ensure k8s config compatibility with kubernetes==12 python client + support proxies
This PR makes two changes related to the way the Kubernetes python client is configured:
kubectl
(fixes Support accessing K8S API server via HTTPS_PROXY env vars #64)Kubernetes Python client v12 compatibility
The Kubernetes python client v12 seems to have somehow changed the way the default configuration works; such that if you create a
Configuration()
object you don't get the default configuration by default.See kubernetes-client/python#1284 and kubernetes-client/python@b4d11b0#diff-59aff6ce4d28aa662f8b411b9d0dfe4f3e949c32a5edaf8e08905b58e7a41ee3L69-R71
Since we don't actually try to customise the
ApiClient
or theConfiguration
at all, it seems we are better to let the client handle creating with defaults that we have previously loaded.Previously the script would fail on Kubernetes Python Client v12
modify_k8s_autoscaler
if enabledTAINT_NODES
setting (after waiting for node counts to match)Notable is that it would get past node count matching; probably because that code didn't construct a manual configuration.
e.g
Changes tested with both Kubernetes client v10 and v12.
HTTPS_PROXY/HTTP_PROXY support
Adds support for standard OS-level env vars to set the proxy on the default configuration loaded from either the in-cluster or standard kube config.
This will only work for TLS passthrough proxies; since the client validates the certificates. Tested with mitmproxy against a real cluster.