Skip to content

Conversation

@hugoponthieu
Copy link
Contributor

@hugoponthieu hugoponthieu commented Nov 23, 2025

Motivation

Since 1.33 the resize of pods resources is available. The goal of this PRs is to provide a convenient way to do it.
This is linked to #1793

Solution

I implemented:

  • get_resize
  • patch_resize
  • replace_resize

I followed was has been done in before in the subresources.

@codecov
Copy link

codecov bot commented Nov 24, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.6%. Comparing base (9a584df) to head (de3b4f7).

Additional details and impacted files
@@           Coverage Diff           @@
##            main   #1851     +/-   ##
=======================================
- Coverage   74.7%   74.6%   -0.0%     
=======================================
  Files         84      84             
  Lines       7910    7912      +2     
=======================================
  Hits        5902    5902             
- Misses      2008    2010      +2     
Files with missing lines Coverage Δ
kube-client/src/api/mod.rs 65.4% <ø> (ø)
kube-client/src/api/subresource.rs 63.1% <100.0%> (+0.6%) ⬆️

... and 4 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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 for this. i think this is almost perfect, minor suggestion and question about a potential addition, but happy to merge at green (EDIT: oh, it passed fmt).

Comment on lines +99 to +101
if let Some(spec) = &mut current_pod.spec {
if let Some(container) = spec.containers.get_mut(0) {
if let Some(resources) = &mut container.resources {
Copy link
Member

Choose a reason for hiding this comment

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

you can avoid some rightward drift here by using a let-chain

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ty for this langage tips ! I did not know about it.
Done.

Copy link
Member

Choose a reason for hiding this comment

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

thanks looks great! you might have to backout of it atm to merge the pr (see my normal comment below), but i can use your commit in a follow-up afterwards where i'm fixing rustfmt / build issues.

Comment on lines +96 to +97
info!("Example 3: Using replace_resize method");
let mut current_pod = pods.get_resize("resize-demo").await?;
Copy link
Member

Choose a reason for hiding this comment

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

do you think it's possible and/or worth extending the conditions module to be able to wait for the PodResizePending or / PodResizeInProgress condition to complete?

i feel like if you are patching things like this you might want to "wait for it to complete", and if an await_condition hasn't succeeded in like 10s then maybe people would look into whether the request was "Infeasible" / "Deferred" themselves.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would like to implement this. Is it possible to create an issue from this comment ?

Copy link
Member

Choose a reason for hiding this comment

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

sure thing, feel free to copy paste it before or after merge (or i can write one after merge). just leave this comment unresolved until we write one. 😄

@clux clux added the changelog-add changelog added category for prs label Nov 24, 2025
@clux clux added this to the 3.0.0 milestone Nov 24, 2025
@clux clux linked an issue Nov 24, 2025 that may be closed by this pull request
@clux
Copy link
Member

clux commented Nov 24, 2025

ah ugh. i forgot we never finalised the rust 2024 stuff (which let-chains depend on) from rustdoc pov... sorry.

feel free to backout your last change and i can fix this later / cherry pick your last change as part of the rustfmt upgrade (it has some build issues to try to do directly)

@hugoponthieu hugoponthieu force-pushed the feat-resize-subresources branch from dc30de0 to de3b4f7 Compare November 24, 2025 08:57
@clux clux changed the title Resize subresources Add Resize subresource for Pod Nov 24, 2025
@clux clux merged commit 1dfbf1d into kube-rs:main Nov 24, 2025
32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog-add changelog added category for prs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add resize subresource on Pod

2 participants