Skip to content

Commit

Permalink
review + be slightly more resilient without the opt-in
Browse files Browse the repository at this point in the history
basically special-case the empty params case with an internal is_default
(cannot do Eq/PartialEq because upstream types do not have it).

which does mean delete_collection with default delete params keeps on
working on 1.25 (but then immediately breaks if they change from default
without the evar)

Signed-off-by: clux <sszynrae@gmail.com>
  • Loading branch information
clux committed Sep 20, 2022
1 parent 3e9d07f commit f440415
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yml
Expand Up @@ -156,7 +156,8 @@ jobs:
run: cargo build

# Run the equivalent of `just integration`
- run: cargo test --lib --all -- --ignored
- name: Run all default features integration library tests
run: cargo test --lib --all -- --ignored
- name: Run all facade integration library tests with extra features
run: cargo test -p kube --lib --features=derive,runtime -- --ignored --nocapture
- name: Run crd example tests
Expand Down
7 changes: 7 additions & 0 deletions kube-core/src/params.rs
Expand Up @@ -476,6 +476,13 @@ impl DeleteParams {
self.preconditions = Some(preconditions);
self
}

pub(crate) fn is_default(&self) -> bool {
!self.dry_run
&& self.grace_period_seconds.is_none()
&& self.propagation_policy.is_none()
&& self.preconditions.is_none()
}
}

// dryRun serialization differ when used as body parameters and query strings:
Expand Down
4 changes: 3 additions & 1 deletion kube-core/src/request.rs
Expand Up @@ -149,7 +149,9 @@ impl Request {
}
let urlstr = qp.finish();

let data = if std::env::var("KUBE_UNSTABLE_V1_25_DELETE").is_ok() {
let data = if dp.is_default() {
vec![] // default serialize needs to be empty body
} else if std::env::var("KUBE_UNSTABLE_V1_25_DELETE").is_ok() {
// Empty delete params triggers an error in kubernetes v1.25
// https://github.com/kubernetes/kubernetes/issues/111985

Expand Down

0 comments on commit f440415

Please sign in to comment.