⚠ Add context to EventHandler(s)#2139
Merged
k8s-ci-robot merged 1 commit intokubernetes-sigs:masterfrom Jan 26, 2023
Merged
Conversation
Contributor
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: vincepri The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Member
Author
|
/assign @alvaroaleman @sbueringer |
sbueringer
reviewed
Jan 24, 2023
Member
sbueringer
left a comment
There was a problem hiding this comment.
Nice!
Looking forward to use the ctx in our event handlers :)
Just a few nits
This changeset adds a context.Context parameter to every EventHandler call. Most project might use MapFunc specifically to retrieve other objects with clients and potentially enqueue requests to a watching object. A context is useful in these cases to avoid using context.TODO() or Background() which never gets cancelled. Signed-off-by: Vince Prignano <vincepri@redhat.com>
606f970 to
2464a9d
Compare
Member
|
/lgtm /hold |
Member
Author
|
/hold cancel Let me know if folks have any further feedback, we can continue later |
4 tasks
2 tasks
tiraboschi
added a commit
to tiraboschi/operator-lib
that referenced
this pull request
May 5, 2023
…alpha.0 - update k8s dependencies to v0.27.1 - update controller-runtime to v0.15.0-alpha.0 - add context to EventHandler calls, see: kubernetes-sigs/controller-runtime#2139 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
This was referenced May 5, 2023
tiraboschi
added a commit
to tiraboschi/operator-lib
that referenced
this pull request
May 22, 2023
…beta.0 - update k8s dependencies to v0.27.2 - update controller-runtime to v0.15.0-beta.0 - add context to EventHandler calls, see: kubernetes-sigs/controller-runtime#2139 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
tiraboschi
added a commit
to tiraboschi/operator-lib
that referenced
this pull request
May 22, 2023
…beta.0 - update k8s dependencies to v0.27.2 - update controller-runtime to v0.15.0-beta.0 - add context to EventHandler calls, see: kubernetes-sigs/controller-runtime#2139 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
tiraboschi
added a commit
to tiraboschi/operator-lib
that referenced
this pull request
May 23, 2023
- update k8s dependencies to v0.27.2 - update controller-runtime to v0.15.0 - add context to EventHandler calls, see: kubernetes-sigs/controller-runtime#2139 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
openshift-merge-robot
pushed a commit
to operator-framework/operator-lib
that referenced
this pull request
Jun 7, 2023
…114) - update k8s dependencies to v0.27.2 - update controller-runtime to v0.15.0 - add context to EventHandler calls, see: kubernetes-sigs/controller-runtime#2139 Signed-off-by: Simone Tiraboschi <stirabos@redhat.com>
lyarwood
added a commit
to lyarwood/ssp-operator
that referenced
this pull request
Jun 26, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0 * Make `*http.Client` configurable and use/share the same client by default kubernetes-sigs/controller-runtime#2122 * Remove dependency injection functions kubernetes-sigs/controller-runtime#2134, kubernetes-sigs/controller-runtime#2120 * Add context to EventHandler(s) kubernetes-sigs/controller-runtime#2139 * `Validator` and `CustomValidator` interfaces have been modified to allow returning warnings kubernetes-sigs/controller-runtime#2014 * operator-framework is also pinned to ecb9be48837 until a new release is cut supporting controller-runtime v0.15.0 Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
ary1992
added a commit
to ary1992/gardener
that referenced
this pull request
Jun 28, 2023
…as the first parameter for every method. kubernetes-sigs/controller-runtime#2139
lyarwood
added a commit
to lyarwood/ssp-operator
that referenced
this pull request
Jun 28, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0 * Make `*http.Client` configurable and use/share the same client by default kubernetes-sigs/controller-runtime#2122 * Remove dependency injection functions kubernetes-sigs/controller-runtime#2134, kubernetes-sigs/controller-runtime#2120 * Add context to EventHandler(s) kubernetes-sigs/controller-runtime#2139 * `Validator` and `CustomValidator` interfaces have been modified to allow returning warnings kubernetes-sigs/controller-runtime#2014 * operator-framework is also pinned to ecb9be48837 until a new release is cut supporting controller-runtime v0.15.0 Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
lyarwood
added a commit
to lyarwood/ssp-operator
that referenced
this pull request
Aug 9, 2023
https://github.com/kubernetes-sigs/controller-runtime/releases/tag/v0.15.0 * Make `*http.Client` configurable and use/share the same client by default kubernetes-sigs/controller-runtime#2122 * Remove dependency injection functions kubernetes-sigs/controller-runtime#2134, kubernetes-sigs/controller-runtime#2120 * Add context to EventHandler(s) kubernetes-sigs/controller-runtime#2139 * `Validator` and `CustomValidator` interfaces have been modified to allow returning warnings kubernetes-sigs/controller-runtime#2014 * operator-framework is also pinned to ecb9be48837 until a new release is cut supporting controller-runtime v0.15.0 Signed-off-by: Lee Yarwood <lyarwood@redhat.com>
rriski
pushed a commit
to aiven/aiven-operator
that referenced
this pull request
Jan 24, 2024
- Removal of deprecated manager options: - kubernetes-sigs/controller-runtime#2422 - Context added to `EnqueueRequestsFromMapFunc` - kubernetes-sigs/controller-runtime#2139
rriski
pushed a commit
to aiven/aiven-operator
that referenced
this pull request
Jan 24, 2024
- Removal of deprecated manager options: - kubernetes-sigs/controller-runtime#2422 - Context added to `EnqueueRequestsFromMapFunc` - kubernetes-sigs/controller-runtime#2139
rriski
pushed a commit
to aiven/aiven-operator
that referenced
this pull request
Jan 24, 2024
- Removal of deprecated manager options: - kubernetes-sigs/controller-runtime#2422 - Context added to `EnqueueRequestsFromMapFunc` - kubernetes-sigs/controller-runtime#2139
rriski
pushed a commit
to aiven/aiven-operator
that referenced
this pull request
Jan 24, 2024
- Removal of deprecated manager options: - kubernetes-sigs/controller-runtime#2422 - Context added to `EnqueueRequestsFromMapFunc` - kubernetes-sigs/controller-runtime#2139
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This changeset adds a context.Context parameter to every EventHandler call. Most project might use MapFunc specifically to retrieve other objects with clients and potentially enqueue requests to a watching object. A context is useful in these cases to avoid using context.TODO() or Background() which never gets cancelled.
Signed-off-by: Vince Prignano vincepri@redhat.com