kube-rs / kube

Rust Kubernetes client and controller runtime
https://kube.rs
Apache License 2.0
3.03k stars 314 forks source link

Make implicitly dependent feature explicitly depend on each other #1551

Closed clux closed 3 months ago

clux commented 3 months ago

By running an invocation of cargo hack, we found a number of compile issues when using unusual feature combinations, and these are largely rectified by making intended feature pairings explicit.

New Feature Dependencies

Testing Feasibility / cargo hack on CI

Because each feature basically doubles the amount of tests, we do actually need to restrict the input space from the raw powerset a bit. Without restrictions (skipping oidc + oauth mandatory), we get:

However, with grouping of commonly additive features, we can basically halve the number of tests per grouping. A moderately aggressive grouping of small client features (socks5 + http-proxy + gzip), smaller core features (admission + jsonpatch + derive) and client features (client + kubelet-debug) we get:

So, kind of works on CI. Have included it as a test on main only (and this branch explicitly as a PoC).

Limitations

  1. This is only testing feature combinations on the main interface crate kube.
  2. oauth / oidc :: should depend on a tls stack but we cannot make that choice

We do have fallback compile_errors for oidc and oauth, but I have not found a way to tell hack to model this without just excluding them.

codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 75.7%. Comparing base (f74576f) to head (97aae44).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1551 +/- ## ===================================== Coverage 75.7% 75.7% ===================================== Files 79 79 Lines 7252 7252 ===================================== Hits 5487 5487 Misses 1765 1765 ```