Skip to content

fix(kstatus): fine-grained context options for waiting#31735

Merged
gjenkins8 merged 1 commit intohelm:mainfrom
matheuscscp:fine-grained-wait-ctx
Jan 21, 2026
Merged

fix(kstatus): fine-grained context options for waiting#31735
gjenkins8 merged 1 commit intohelm:mainfrom
matheuscscp:fine-grained-wait-ctx

Conversation

@matheuscscp
Copy link
Contributor

@matheuscscp matheuscscp commented Jan 15, 2026

What this PR does / why we need it / Special notes for your reviewer:

This is a critical fix for the feature previously introduced here:

https://github.com/helm/helm/pull/31435/files (see file pkg/kube/statuswait.go)

Basically, Flux cannot pass the custom context to all the waiter methods. Specifically for WatchUntilReady, we can never pass the custom context to it because it means cancelling Helm hooks, which can be very bad, as users use hooks to run e.g. database migrations. Please see this issue for more context: fluxcd/helm-controller#1380 (comment)

If applicable:

  • this PR contains user facing changes (the docs needed label should be applied if so)
  • this PR contains unit tests
  • this PR has been tested for backwards compatibility

@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Jan 15, 2026
@matheuscscp matheuscscp force-pushed the fine-grained-wait-ctx branch 3 times, most recently from 720ce1b to e63e95a Compare January 15, 2026 15:50
banjoh
banjoh previously approved these changes Jan 17, 2026
Copy link
Contributor

@banjoh banjoh left a comment

Choose a reason for hiding this comment

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

Change LGTM. Thanks for the extensive tests

@matheuscscp
Copy link
Contributor Author

@banjoh Pls reapprove 🙏 I rebased after #31730 was merged to fix conflicts

gjenkins8
gjenkins8 previously approved these changes Jan 21, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces fine-grained context control for different waiting methods in Helm's kstatus integration. It enables consumers like Flux to pass different contexts to specific wait methods (e.g., WatchUntilReady, Wait, WaitWithJobs, WaitForDelete) without affecting others. This is critical for Flux to avoid canceling Helm hooks that may be running important operations like database migrations when only the general wait operation should be cancelled.

Changes:

  • Added method-specific context fields to statusWaiter struct and waitOptions type
  • Introduced four new WaitOption functions to set method-specific contexts
  • Modified context resolution logic to use method-specific context with fallback to general context
  • Added comprehensive unit tests covering option setting, context cancellation, fallback behavior, and override scenarios

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
pkg/kube/statuswait.go Added method-specific context fields to statusWaiter and updated contextWithTimeout to support method-specific contexts with fallback
pkg/kube/options.go Added four new WaitOption functions and corresponding fields in waitOptions for method-specific contexts
pkg/kube/client.go Updated newStatusWatcher to pass method-specific contexts from options to statusWaiter
pkg/kube/statuswait_test.go Added comprehensive tests for option functions, context cancellation, fallback, and override behavior

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Signed-off-by: Matheus Pimenta <matheuscscp@gmail.com>
@matheuscscp matheuscscp force-pushed the fine-grained-wait-ctx branch from 748887e to b0b35f1 Compare January 21, 2026 19:03
Copy link
Contributor

@TerryHowe TerryHowe left a comment

Choose a reason for hiding this comment

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

/lgtm

@gjenkins8 gjenkins8 merged commit f9db0ca into helm:main Jan 21, 2026
5 checks passed
@matheuscscp matheuscscp deleted the fine-grained-wait-ctx branch January 21, 2026 19:35
@scottrigby scottrigby changed the title feat(kstatus): fine-grained context options for waiting fix(kstatus): fine-grained context options for waiting Jan 21, 2026
@scottrigby scottrigby added bug Categorizes issue or PR as related to a bug. needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. labels Jan 21, 2026
@scottrigby scottrigby added this to the 4.1.1 milestone Jan 21, 2026
@gjenkins8 gjenkins8 added the picked Indicates that a PR has been cherry-picked into the next release candidate. label Jan 29, 2026
@scottrigby scottrigby removed the needs-pick Indicates that a PR needs to be cherry-picked into the next release candidate. label Feb 9, 2026
@joejulian joejulian modified the milestones: 4.1.1, 4.1.2 Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Categorizes issue or PR as related to a bug. picked Indicates that a PR has been cherry-picked into the next release candidate. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants