Skip to content
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

⚠️ Remove options.WarningHandler #2903

Merged

Conversation

dlipovetsky
Copy link
Contributor

@dlipovetsky dlipovetsky commented Aug 5, 2024

As a follow-up to #2887, and #2896, this removes client.Options.WarningHandler.

Instead of using client.Options.WarningHandler users define config.WarningHandler. This change:

  • Reduces the number of "sources" of warning handler configuration from two to one, and thereby reduces confusion.
  • Allows users to define custom warning handlers, and thereby increases flexibility.
  • Removal does not change the default behavior, which is to de-duplicate and surface warnings.

Note: Because the PR changes the go module public API, the "pull-controller-runtime-apidiff" test fails, as expected.

- Removal does not change the default behavior of the client, which is
  to de-duplicate and surface API warnings.
- Uses config.WarningHandler to override default behavior. Describes
  this in the client.New godoc, adds an example test to demonstrate it,
  and a unit test to verify it.
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Aug 5, 2024
@dlipovetsky dlipovetsky changed the title Remove options.WarningHandler ⚠️ Remove options.WarningHandler Aug 5, 2024
@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Aug 5, 2024
@k8s-ci-robot
Copy link
Contributor

@dlipovetsky: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-controller-runtime-apidiff 4a356a8 link false /test pull-controller-runtime-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@sbueringer sbueringer added this to the v0.19.x milestone Aug 6, 2024
@sbueringer
Copy link
Member

Thx!

/lgtm
/assign @alvaroaleman @vincepri

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 6, 2024
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 2623bb44e8684a5b63a238d1fd1b8a384e7ff334

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alvaroaleman, dlipovetsky

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 6, 2024
@k8s-ci-robot k8s-ci-robot merged commit 79b5481 into kubernetes-sigs:main Aug 6, 2024
16 of 18 checks passed
brooke-hamilton added a commit to radius-project/radius that referenced this pull request Oct 7, 2024
…troller-runtime (#7979)

# Description

A [recent
change](kubernetes-sigs/controller-runtime#2903)
to the
[`controller-runtime`](https://github.com/kubernetes-sigs/controller-runtime/)
package caused Radius compilation errors and test failures, as
referenced in #7882. Breaking changes in `controller-runtime` include
the removal of a configuration option, and a new validation that
prevents duplicate controller names. This PR makes changes to update the
packages referenced, fix the compilation errors, and address the test
failures.

Changes include:
- Updates to `go.mod` and `go.sum`.
- Fixed compiler errors by moving the warning suppression configuration
from the `controller-runtime/pkg/client` options to
`client-go/rest/Config`, as required by the changes in
`controller-runtime`.
- Fixed broken tests by adding the `SkipNameValidation` configuration
parameter to unit tests for creating new controllers.
- Some refactoring of commonly shared test functions and constants in
`cli/controller/reconciler` into `shared-test.go`.

> NOTE: The compilation fix in this PR did not change the behavior of
the `rad` cli--only the tests were changed. The assumption is that `rad`
does not ever create controllers with duplicate names, so suppressing
the duplicate controller name validation is not necessary, even though
it is necessary in the automated tests.

## Type of change

- This pull request fixes a bug in Radius and has an approved issue
(issue link required).

Fixes: #7882 

## Contributor checklist
Please verify that the PR meets the following requirements, where
applicable:

- [ ] An overview of proposed schema changes is included in a linked
GitHub issue.
- [ ] A design document PR is created in the [design-notes
repository](https://github.com/radius-project/design-notes/), if new
APIs are being introduced.
- [ ] If applicable, design document has been reviewed and approved by
Radius maintainers/approvers.
- [ ] A PR for the [samples
repository](https://github.com/radius-project/samples) is created, if
existing samples are affected by the changes in this PR.
- [ ] A PR for the [documentation
repository](https://github.com/radius-project/docs) is created, if the
changes in this PR affect the documentation or any user facing updates
are made.
- [ ] A PR for the [recipes
repository](https://github.com/radius-project/recipes) is created, if
existing recipes are affected by the changes in this PR.

---------

Signed-off-by: Brooke Hamilton <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants