Skip to content

Remove silent error when client-key/client-certificate is malformed#1966

Merged
clux merged 5 commits into
kube-rs:mainfrom
goenning:go/fix-silent-err
May 4, 2026
Merged

Remove silent error when client-key/client-certificate is malformed#1966
clux merged 5 commits into
kube-rs:mainfrom
goenning:go/fix-silent-err

Conversation

@goenning
Copy link
Copy Markdown
Contributor

Motivation

malformed client-key/client-certificate are currently being ignored

Solution

bubble up the error instead of silently ignoring it

Signed-off-by: goenning <me@goenning.net>
Signed-off-by: goenning <me@goenning.net>
@goenning goenning changed the title Remove silent error Remove silent error when client-key/client-certificate is malformed Mar 27, 2026
Signed-off-by: goenning <me@goenning.net>
Signed-off-by: goenning <me@goenning.net>
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 30, 2026

Codecov Report

❌ Patch coverage is 77.77778% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.5%. Comparing base (e7060a8) to head (c0e456a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
kube-client/src/config/file_config.rs 79.0% 4 Missing ⚠️
kube-client/src/client/config_ext.rs 66.7% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1966     +/-   ##
=======================================
- Coverage   76.5%   76.5%   -0.0%     
=======================================
  Files         89      89             
  Lines       8585    8596     +11     
=======================================
+ Hits        6565    6569      +4     
- Misses      2020    2027      +7     
Files with missing lines Coverage Δ
kube-client/src/config/mod.rs 54.7% <100.0%> (ø)
kube-client/src/client/config_ext.rs 52.5% <66.7%> (-0.1%) ⬇️
kube-client/src/config/file_config.rs 78.5% <79.0%> (-0.9%) ⬇️

... and 3 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@clux clux added the changelog-fix changelog fix category for prs label May 1, 2026
@clux clux added this to the 4.0.0 milestone May 1, 2026
Copy link
Copy Markdown
Member

@clux clux left a comment

Choose a reason for hiding this comment

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

Thanks for this. Sorry, just getting around to things again.

One minor request if you have time for it, otherwise this looks sensible to me.

Comment on lines +636 to +649
pub(crate) fn identity_pem(&self) -> Result<Option<Vec<u8>>, KubeconfigError> {
let client_cert = self.load_client_certificate()?;
let client_key = self.load_client_key()?;

match (client_cert, client_key) {
(None, None) => Ok(None),

(Some(_), None) => Err(KubeconfigError::LoadClientKey(
LoadDataError::NoBase64DataOrFile,
)),

(None, Some(_)) => Err(KubeconfigError::LoadClientCertificate(
LoadDataError::NoBase64DataOrFile,
)),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

a test for an error case here might be useful, since this is a bit difficult to fully trust in your head

@clux clux merged commit 21b0f61 into kube-rs:main May 4, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-fix changelog fix category for prs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants