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 removing hyper-rustls/ring feature #1717

Merged
merged 1 commit into from
Mar 12, 2025

Conversation

eliad-wiz
Copy link
Contributor

Motivation

no reason to include the "ring" crate if aws-lc-rs is being used.

Solution

features are only additive, so they can't be removed once it's added (by any sub-crate).
avoid adding extra features that might not be used (e.g. in case of aws-lc-rs).

in order to make it optional we can add a new "ring" feature to the default features, so it can be avoided with default-features = false. however, i think letting the configure it as needed is a better approach.

please update if you do prefer to add a new default feature-flag (or some other approach) and i'll adjust the patch.

@eliad-wiz eliad-wiz force-pushed the remove-ring-dependency branch 3 times, most recently from 066cc7a to 6f04610 Compare March 9, 2025 16:47
@clux clux added the changelog-change changelog change category for prs label Mar 11, 2025
@eliad-wiz eliad-wiz force-pushed the remove-ring-dependency branch from 6f04610 to 467eb1a Compare March 11, 2025 11:44
Copy link

codecov bot commented Mar 11, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.1%. Comparing base (ab488ae) to head (bba11ca).
Report is 2 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #1717   +/-   ##
=====================================
  Coverage   76.1%   76.1%           
=====================================
  Files         84      84           
  Lines       7859    7859           
=====================================
  Hits        5976    5976           
  Misses      1883    1883           
Files with missing lines Coverage Δ
kube-client/src/client/auth/oidc.rs 56.4% <ø> (ø)
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

#[cfg(not(any(
all(
feature = "rustls-tls",
any(feature = "ring", feature = "aws-lc-rs", feature = "webpki-roots")
Copy link
Member

@clux clux Mar 11, 2025

Choose a reason for hiding this comment

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

i think we need (when using rustls);

  • one of aws-lc-rs or ring
  • webpki-roots optional, but orthogonal to this choice (so probably does not need to be checked here)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

see my previous comment.
let's try adding cfg-if to make it a bit clearer

Copy link
Member

@clux clux Mar 11, 2025

Choose a reason for hiding this comment

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

i think we can avoid this extra change and dependency, and keep all logic as we had it before by introducing the new compile error up to top level (257 in oidc.rs).

#[cfg(all(feature = "rustls-tls", not(any(feature = "ring", feature = "aws-lc-rs"))))]
compile_error!("At least one of ring or aws-lc-rs feature must be enabled to use rustls-tls feature");

Copy link
Member

@clux clux Mar 11, 2025

Choose a reason for hiding this comment

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

mostly because the way it's indented now is also quite big and hard to extend, and we want to just bail out as soon as possible anyway.

besides, oidc.rs isn't even the client that is used for most things (that one comes from config_ext.rs + builder.rs and does the selection in tls.rs (which does not do this same if-else on providers).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

btw, are you fine with removing the auto-installation of the aws-lc-rs provider if aws-lc-rs feature was set?
theoretically both ring and aws-lc-rs might be enabled, and we should leave it to the user (or let rustls install if only one of them was selected)

Copy link
Member

Choose a reason for hiding this comment

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

removing auto-installation

not super comfortable touching this yet. removing it outright will feel breaking, and it's a very low level api people will have to familiarise themselves with to do basic things when using aws-lc-rs. if aws-lc-rs becomes the default, i would want it to be frictionless, and this feels ok to me as a 'helping hand'; install if it hasn't been installed already. nothing stops people from installing another default provider else earlier on.

this might turn into a bigger discussion though. maybe we need to do the same thing we did for openssl vs rustls; always speculatively install one provider, tilting towards our default. that way we can change our default later on (like we did for openssl -> rustls).

@eliad-wiz eliad-wiz force-pushed the remove-ring-dependency branch from 467eb1a to e0f4a9a Compare March 11, 2025 13:57
@eliad-wiz eliad-wiz force-pushed the remove-ring-dependency branch from e0f4a9a to 375899d Compare March 11, 2025 15:00
no reason to include the "ring" crate if aws-lc-rs is being used.

add a new "ring" feature (enabled by default, to avoid breaking
existing users), that will enable hyper-rustls/ring only if needed.

Signed-off-by: Eliad Peller <eliad.peller@wiz.io>
@eliad-wiz eliad-wiz force-pushed the remove-ring-dependency branch from 375899d to bba11ca Compare March 12, 2025 05:59
@@ -12,10 +12,11 @@ keywords = ["kubernetes", "client",]
categories = ["web-programming::http-client", "network-programming", "api-bindings"]

[features]
default = ["client"]
default = ["client", "ring"]
Copy link
Member

@clux clux Mar 12, 2025

Choose a reason for hiding this comment

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

Suggested change
default = ["client", "ring"]
default = ["client", "rustls-tls", "ring"]

possibly worth listing this explicitly. EDIT: ah, but it's explicit in kube/Cargo.toml

@clux clux added this to the 0.99.0 milestone Mar 12, 2025
Copy link
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 a lot. Sorry about all the back and forths. I'll get this in before the release.

@clux clux merged commit 56109ad into kube-rs:main Mar 12, 2025
17 checks passed
@clux
Copy link
Member

clux commented Mar 12, 2025

minor follow-up #1720

@clux clux changed the title deps: remove hyper-rustls/ring feature Allow removing hyper-rustls/ring feature Mar 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog-change changelog change category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants