Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Make implicitly dependent feature explicitly depend on each other #1551

Merged
merged 4 commits into from
Jul 30, 2024

Conversation

clux
Copy link
Member

@clux clux commented Jul 24, 2024

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

  • rustls-tls + openssl-tls now depend on client
  • oauth + oidc + gzip + socks5 + http-proxy + unstable-client now depend on client
  • unstable-runtime now depend on runtime

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:

  • 11370 feature combinations
  • >1h duration locally (my CPU sits mostly sitting idle in context switches)
  • generates >60G of artifacts in target

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:

  • 624 feature combinations
  • 5m duration locally on a blank cache / 8m duration on GHA with cache
  • generates 6G of artifacts in target

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.

By running a variant 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.

Client features now depend on the `client` feature, runtime features
now depend on the `runtime` feature, etc.

- rustls-tls / openssl-tls => `client` feature
- oauth / oidc / gzip / socks5 / http-proxy => `client` feature
- unstable-runtime => `runtime` feature

Unfortunately, the cargo hack solution is simplistic and cannot verify everything AFAIKT yet.
I am currently running with excluding oauth and oidc because these
require picking a tls stack and we have an intended compile error for this.
I cannot find a way to tell `hack` to model this without just excluding them.

The number of features makes the combination features test very long,
case in point, the cargo hack invocation in the justfile:

- tests **11370** feature combinations
- takes >2h (currently 30m in at 2000 combination on a beefy 7950X3D)

Signed-off-by: clux <sszynrae@gmail.com>
@clux clux added this to the 0.94.0 milestone Jul 24, 2024
@clux clux added changelog-fix changelog fix category for prs changelog-change changelog change category for prs and removed changelog-fix changelog fix category for prs labels Jul 24, 2024
Copy link

codecov bot commented Jul 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

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

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

clux added 3 commits July 24, 2024 21:47
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
Signed-off-by: clux <sszynrae@gmail.com>
@clux clux marked this pull request as ready for review July 24, 2024 21:20
@clux clux requested a review from nightkr July 30, 2024 11:08
@clux clux merged commit de12b71 into main Jul 30, 2024
19 checks passed
@clux clux deleted the hack-features branch July 30, 2024 13:18
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
changelog-change changelog change category for prs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants