-
Notifications
You must be signed in to change notification settings - Fork 40k
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
Wire contexts to Apps controllers #105377
Conversation
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.
I found still a few context.TODO()
instances I've listed above.
/assign
/triage accepted
/priority backlog
@@ -141,22 +141,22 @@ func NewStatefulSetController( | |||
} |
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.
a few more in:
pkg/controller/statefulset/stateful_set_status_updater.go
pkg/controller/statefulset/stateful_pod_control.go
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 comment still holds.
2828eb2
to
55b38c3
Compare
/test pull-kubernetes-node-e2e-containerd |
55b38c3
to
7a2748f
Compare
40befc1
to
6f5471d
Compare
/retest |
/retest |
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.
A few more nits, but we can handle them in a followups.
/lgtm
/approve
@@ -141,22 +141,22 @@ func NewStatefulSetController( | |||
} |
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 comment still holds.
/lgtm cancel |
Consider a retitle of the PR, as I don't think all Apps controller are covered. |
This is referring to the KCM Apps controllers, in |
Uhm.. kind of tricky, as batch is under sig-apps, but it's listed separately. Maybe you can say core apps (the core API). But it's a nit. |
04bb6a9
to
3405184
Compare
/retest |
/kind feature We are removing the |
set *apps.StatefulSet, | ||
status *apps.StatefulSetStatus) error { | ||
// don't wait due to limited number of clients, but backoff after the default number of steps | ||
return retry.RetryOnConflict(retry.DefaultRetry, func() error { | ||
set.Status = *status | ||
_, updateErr := ssu.client.AppsV1().StatefulSets(set.Namespace).UpdateStatus(context.TODO(), set, metav1.UpdateOptions{}) | ||
_, updateErr := ssu.client.AppsV1().StatefulSets(set.Namespace).UpdateStatus(ctx, set, metav1.UpdateOptions{}) |
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.
We need to pass context here through RetryOnConflict
, so revert this back to context.TODO
for now and we'll need a separate PR to add RetryOnConflictWithContext
similarly to how we have wait.UntilWithContext
as discussed with @sttts offline.
c3562d7
to
c5a4335
Compare
@@ -310,15 +310,15 @@ func NewReplicaSetControllerRefManager( | |||
// If the error is nil, either the reconciliation succeeded, or no | |||
// reconciliation was necessary. The list of ReplicaSets that you now own is | |||
// returned. | |||
func (m *ReplicaSetControllerRefManager) ClaimReplicaSets(sets []*apps.ReplicaSet) ([]*apps.ReplicaSet, error) { | |||
func (m *ReplicaSetControllerRefManager) ClaimReplicaSets(ctx context.Context, sets []*apps.ReplicaSet) ([]*apps.ReplicaSet, error) { | |||
var claimed []*apps.ReplicaSet | |||
var errlist []error | |||
|
|||
match := func(obj metav1.Object) bool { | |||
return m.Selector.Matches(labels.Set(obj.GetLabels())) | |||
} | |||
adopt := func(obj metav1.Object) error { |
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.
You'll need the context being argument here too.
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.
I actually missed all of these adopt
functions... updated to add the param to them all. Could you check that I did that right again? This one looks similar to the last, where I think I need to pass ctx
as an extra parameter along with the functions, but I'm pretty sure I actually need that now
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.
One more nit about adopt
function in pkg/controller/controller_ref_manager.go
and what about that wait.UntilWithContext
in pkg/controller/daemon/daemon_controller.go
@@ -56,7 +56,8 @@ func (ssu *realStatefulSetStatusUpdater) UpdateStatefulSetStatus( | |||
// don't wait due to limited number of clients, but backoff after the default number of steps | |||
return retry.RetryOnConflict(retry.DefaultRetry, func() error { | |||
set.Status = *status | |||
_, updateErr := ssu.client.AppsV1().StatefulSets(set.Namespace).UpdateStatus(ctx, set, metav1.UpdateOptions{}) | |||
// TODO: This context.TODO should use a real context once we have RetryOnConflictWithContext | |||
_, updateErr := ssu.client.AppsV1().StatefulSets(set.Namespace).UpdateStatus(context.TODO(), set, metav1.UpdateOptions{}) |
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.
👍
c5a4335
to
41fcb95
Compare
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
/approve
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: damemi, soltysh, sttts The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What type of PR is this?
/kind design
What this PR does / why we need it:
This wires a context to Apps controllers in kube-controller-manager, so that KCM can eventually release on cancel.
This originally came from PR #101379, which builds on top of #101125
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?
Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.: