-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Introduce kstatus watcher #13604
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce kstatus watcher #13604
Conversation
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
gjenkins8
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
made an initial pass. biggest concern, is it looks like we are modifying the global cfg object. other things mostly nits
need to make a second pass to that looks at some of the logic in depth
pkg/action/rollback.go
Outdated
| return err | ||
| } | ||
|
|
||
| if err := r.cfg.KubeClient.SetWaiter(r.Wait); err != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is modifying the "gloabl" cfg object iiuc? I believe Helm supports multiple concurrent actions via the SDK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yeah great catch. I could move the SetWaiter call to the command line, but then library users would miss out on the logic to set the waiter when atomic is set. Any thoughts on how this could best be handled?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't we want a GetWaiter interface e.g:
waiter, err := r..cfg.KubeClient.GetWaiter(r.Wait)
This would be done where the waiter was needed of course. It would require passing the Wait strategy through to where required (rather than poking into the global)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, I'll try that out
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with a strategy like above, lmk what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
GetWaiter looks to be addressed in this commit 386523b.
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Co-authored-by: George Jenkins <gvjenkins@gmail.com> Signed-off-by: Austin Abro <37223396+AustinAbro321@users.noreply.github.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
|
I've tested the RESTMapper from kubernetes-sigs/controller-runtime#3151 and the issue with preferred version has been fixed. I suggest waiting on @alvaroaleman PR to be merged and backported to controller-runtime v0.20. Then we can drop the RESTMapper vendoring from this PR and use upstream. |
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
Signed-off-by: Austin Abro <AustinAbro321@gmail.com>
|
@stefanprodan I added dependency |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
Same reasoning as here #13604 (review), but also reviewed how feedback from @gjenkins8 was addressed 👍 and also excellent that was landed in upstream sigs.k8s.io/controller-runtime as pointed out by @stefanprodan and implemented in this PR.
This is a large PR for Helm, but something Helm maintainers have wanted to see in Helm for a while. This is extremely well done, and given our Helm 4 schedule I think this is our best opportunity to get kstatus support into Helm.
Also special thanks to @stefanprodan for the thorough review—this feedback is invaluable since Flux figured out how to properly add kstatus support as a Helm SDK user. It's worth noting that this kstuatus support approach has been long since thoroughly tested by Helm users via Flux.
sabre1041
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Verified test cases
While looking at SDK feature for v4. I was surprise with the error: > "reporter failed to start: event funnel closed: context deadline exceeded" It is related when you forgot to set a minimal timeout: ```go upgradeClient := action.NewUpgrade(actionConfig) upgradeClient.WaitStrategy = kube.StatusWatcherStrategy // When Timeout is zero, the status wait uses a context with zero timeout which // immediately expires causing "context deadline exceeded" errors. upgradeClient.Timeout = 2 * time.Minute ``` Also maybe it should be even more documented. Initial [PR](helm#13604) say: > I have not written any docs, I assume that can be done when we are closer to Helm 4, a lot of it is covered by linking to - https://github.com/kubernetes-sigs/cli-utils/blob/master/pkg/kstatus/README.md Related: - helm#31411 (comment)
> "reporter failed to start: event funnel closed: context deadline exceeded" It happens when you forget to set a minimal timeout: ```go upgradeClient := action.NewUpgrade(actionConfig) upgradeClient.WaitStrategy = kube.StatusWatcherStrategy // When Timeout is zero, the status wait uses a context with zero timeout which // immediately expires causing "context deadline exceeded" errors. upgradeClient.Timeout = 2 * time.Minute ``` Also maybe it might be worth documenting this more clearly. Initial [PR](helm#13604) say: > I have not written any docs, I assume that can be done when we are closer to Helm 4, a lot of it is covered by linking to - https://github.com/kubernetes-sigs/cli-utils/blob/master/pkg/kstatus/README.md Related: - helm#31411 (comment) Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
> "reporter failed to start: event funnel closed: context deadline exceeded" It happens when you forget to set a minimal timeout: ```go upgradeClient := action.NewUpgrade(actionConfig) upgradeClient.WaitStrategy = kube.StatusWatcherStrategy // When Timeout is zero, the status wait uses a context with zero timeout which // immediately expires causing "context deadline exceeded" errors. upgradeClient.Timeout = 2 * time.Minute ``` Also maybe it might be worth documenting this more clearly. Initial [PR](helm#13604) say: > I have not written any docs, I assume that can be done when we are closer to Helm 4, a lot of it is covered by linking to - https://github.com/kubernetes-sigs/cli-utils/blob/master/pkg/kstatus/README.md Related: - helm#31411 (comment) Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
> "reporter failed to start: event funnel closed: context deadline exceeded" It happens when you forget to set a minimal timeout: ```go upgradeClient := action.NewUpgrade(actionConfig) upgradeClient.WaitStrategy = kube.StatusWatcherStrategy // When Timeout is zero, the status wait uses a context with zero timeout which // immediately expires causing "context deadline exceeded" errors. upgradeClient.Timeout = 2 * time.Minute ``` Also maybe it might be worth documenting this more clearly. Initial [PR](helm#13604) say: > I have not written any docs, I assume that can be done when we are closer to Helm 4, a lot of it is covered by linking to - https://github.com/kubernetes-sigs/cli-utils/blob/master/pkg/kstatus/README.md Related: - helm#31411 (comment) Signed-off-by: Benoit Tigeot <benoit.tigeot@lifen.fr>
closes #8661
What this PR does / why we need it:
This PR introduces a statusWaiter using kstatus. More details here - H4HIP: Wait with kstatus
Notes to reviewers:
SetWaiter(kube.StatusWatcherStrategy)on akube.Clientobject then callingclient.WaitIf applicable:
docs neededlabel should be applied if so)