controller-runtime icon indicating copy to clipboard operation
controller-runtime copied to clipboard

:sparkles: feat: new features about support warning with webhook

Open STRRL opened this issue 2 years ago • 2 comments

Signed-off-by: STRRL [email protected]

close https://github.com/kubernetes-sigs/controller-runtime/issues/1896

Two new interfaces ValidatorWarn and CustomValidatorWarn, for support warnings in validating webhooks.

STRRL avatar Sep 29 '22 06:09 STRRL

Hi @STRRL. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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/test-infra repository.

k8s-ci-robot avatar Sep 29 '22 06:09 k8s-ci-robot

/ok-to-test

camilamacedo86 avatar Nov 01 '22 20:11 camilamacedo86

/test pull-controller-runtime-test-master

camilamacedo86 avatar Nov 01 '22 21:11 camilamacedo86

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: STRRL Once this PR has been reviewed and has the lgtm label, please assign pwittrock for approval by writing /assign @pwittrock in a comment. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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 avatar Nov 03 '22 04:11 k8s-ci-robot

happy to see new progress on this PR; I have fixed the test cases and linter :)

PTAL @camilamacedo86

STRRL avatar Nov 03 '22 07:11 STRRL

Would this implementation effectively supersede the existing high-level validator interfaces? At first glance, it seems like it has identical functionality except that it can also return warnings?

I worry about maintaining both (almost identical) implementations over time.

I commented over on the issue, but I think we could use the existing interfaces and have a custom error type that includes the warnings like you suggest.

joelanford avatar Nov 08 '22 21:11 joelanford

I worry about maintaining both (almost identical) implementations over time. I commented over on the issue, but I think we could use the existing interfaces and have a custom error type that includes the warnings like you suggest.

I agree. We should definitely avoid introducing a third set of interfaces. I'll continue on the issue. Let's keep the discussion there for now to avoid concurrent threads.

sbueringer avatar Nov 25 '22 12:11 sbueringer

just mention the discussion result: we prefer to break the API instead of introducing a new type called ErrorWithWarnings, ref: https://github.com/kubernetes-sigs/controller-runtime/issues/1896#issuecomment-1327672092

STRRL avatar Dec 05 '22 12:12 STRRL

Hi! I have updated this PR with these changes:

  • stop using goerrors "errors" in import
  • move error as the last value returned by methods, eg. ValidateCreate() ( err error, warnings []string) -> ValidateCreate() (warnings []string, err error)

STRRL avatar Dec 05 '22 13:12 STRRL

Hi! I have updated this PR with these changes:

  • stop using goerrors "errors" in import
  • move error as the last value returned by methods, eg. ValidateCreate() ( err error, warnings []string) -> ValidateCreate() (warnings []string, err error)

/cc @invidian @sbueringer

STRRL avatar Dec 05 '22 13:12 STRRL

Thx sorry for the late response, will review soon

sbueringer avatar Jan 10 '23 19:01 sbueringer

Thanks for putting this PR together @STRRL 👏 also interested into this.

Agree with @sbueringer et al. here.

damdo avatar Feb 01 '23 18:02 damdo

@STRRL do you have time to address the findings above?

sbueringer avatar Feb 08 '23 06:02 sbueringer

@STRRL do you have time to address the findings above?

yeah! I would follow up!

STRRL avatar Feb 09 '23 00:02 STRRL

/retest

resolved the conflicts

STRRL avatar Feb 09 '23 01:02 STRRL

/retest

STRRL avatar Feb 09 '23 01:02 STRRL

ptal @sbueringer :heart:

STRRL avatar Feb 09 '23 02:02 STRRL

Updated! PTAL @sbueringer :heart:

STRRL avatar Feb 21 '23 14:02 STRRL

Thank you!

/lgtm

/assign @vincepri @alvaroaleman

sbueringer avatar Feb 23 '23 11:02 sbueringer

/hold

There are merge commits in this PR, can we remove them please?

vincepri avatar Feb 23 '23 17:02 vincepri

/hold

There are merge commits in this PR, can we remove them please?

Sure, I would rebase them.

STRRL avatar Mar 23 '23 02:03 STRRL

/hold There are merge commits in this PR, can we remove them please?

Sure, I would rebase them.

Done

STRRL avatar Apr 13 '23 14:04 STRRL

/cc @vincepri @sbueringer

PTAL

STRRL avatar Apr 13 '23 14:04 STRRL

@STRRL: 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 b2a955209912f188758a1ae2281f8cea691a6126 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/test-infra repository. I understand the commands that are listed here.

k8s-ci-robot avatar Apr 17 '23 07:04 k8s-ci-robot

Looks good thx!

@STRRL can you please squash the commits?

/lgtm

sbueringer avatar Apr 17 '23 13:04 sbueringer

/assign @vincepri

sbueringer avatar Apr 17 '23 13:04 sbueringer

/approve

vincepri avatar Apr 19 '23 13:04 vincepri

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: STRRL, vincepri

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 avatar Apr 19 '23 13:04 k8s-ci-robot

/hold cancel

vincepri avatar Apr 19 '23 14:04 vincepri