kube-rs / kube

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

Add a compile_error if setting selectable fields on K8s < 1.30 #1612

Closed clux closed 1 month ago

clux commented 1 month ago

As it is not available on older Kubernetes versions.

Doing this now causes:

error: selectable fields require Kubernetes >= 1.30
  --> examples/crd_derive.rs:12:10
   |
12 | #[derive(CustomResource, Serialize, Deserialize, Default, Debug, PartialEq, Eq, Clone, JsonSchema)]
   |          ^^^^^^^^^^^^^^
   |
   = note: this error originates in the derive macro `CustomResource` (in Nightly builds, run with -Z macro-backtrace for more info)

(can be seen if hacking examples/cargo.toml to use earliest from k8s-openapi)

Follow-up to #1610

codecov[bot] commented 1 month ago

Codecov Report

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

Project coverage is 75.3%. Comparing base (7526539) to head (48ec7a0). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1612 +/- ## ======================================= + Coverage 75.3% 75.3% +0.1% ======================================= Files 82 82 Lines 7340 7343 +3 ======================================= + Hits 5524 5527 +3 Misses 1816 1816 ``` | [Files with missing lines](https://app.codecov.io/gh/kube-rs/kube/pull/1612?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kube-rs) | Coverage Δ | | |---|---|---| | [kube-derive/src/custom\_resource.rs](https://app.codecov.io/gh/kube-rs/kube/pull/1612?src=pr&el=tree&filepath=kube-derive%2Fsrc%2Fcustom_resource.rs&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=kube-rs#diff-a3ViZS1kZXJpdmUvc3JjL2N1c3RvbV9yZXNvdXJjZS5ycw==) | `81.5% <100.0%> (+0.4%)` | :arrow_up: |