Skip to content
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

Allow null values when parsing exec from kubeconfig #156

Merged
merged 1 commit into from
Sep 14, 2023

Conversation

bpartridge
Copy link
Contributor

@bpartridge bpartridge commented Sep 13, 2023

Many kubeconfig generators & tutorials (such as the default setup for GKE) cause null values to be added for user.exec.env and user.exec.args. The official client found it relevant to fix this exact issue here in 2018: kubernetes-client/python-base#91

This relaxes the auth code to treat null/falsey values as empty args/env.

While a workaround is removing the null rows from one's kubeconfig, it's not necessarily given that people know how to do this (or have permissions, with certain setups!), so it can cause first-time users to see a TypeError as the first thing they see upon using the library. There should be no downsides to the fix.

Many kubeconfig generators & tutorials (such as the [default setup for GKE](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl)) cause `null` values to be added for user.exec.env and user.exec.args. The official client found it relevant to fix this exact issue here in 2018: kubernetes-client/python-base#91

This relaxes the auth code to treat null values as empty args/env.
@github-actions github-actions bot added the kr8s label Sep 13, 2023
Copy link
Member

@jacobtomlinson jacobtomlinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome stuff thanks!

@codecov
Copy link

codecov bot commented Sep 14, 2023

Codecov Report

Merging #156 (388b75c) into main (c4d9f71) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##             main     #156   +/-   ##
=======================================
  Coverage   95.25%   95.25%           
=======================================
  Files          25       25           
  Lines        2299     2299           
=======================================
  Hits         2190     2190           
  Misses        109      109           
Files Changed Coverage Δ
kr8s/_auth.py 91.89% <100.00%> (ø)

@jacobtomlinson jacobtomlinson merged commit f3c3044 into kr8s-org:main Sep 14, 2023
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants