-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Handle "Result" errors as non-fatal errors in kyaml FilterFuncs #4241
Handle "Result" errors as non-fatal errors in kyaml FilterFuncs #4241
Conversation
@Goodwine: This PR has multiple commits, and the default merge method is: merge. 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. |
Hi @Goodwine. 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 Once the patch is verified, the new status will be reflected by the 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. |
/assign @KnVerey |
15fbfde
to
1935061
Compare
When looking at the behavior changes needed here I realized that not all processors behaved the same with This is quite a change so I'll wait to discuss this further this week |
8a6f489
to
ab524da
Compare
…re in ResourceList - Result can only count as error when passed as pointer, this makes easy use of "errors.As" - Existing Filter() implementations that return Result from the `framework` package won't return an error anymore but modify the ResourceList
ab524da
to
894ffec
Compare
After discussing with Katrina over slack we reached out conclusion that the original PR was OK, we don't need to overreach with The only 2 key things worth mentioning are
|
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
/hold for @natasha41575 to approve
Co-authored-by: Katrina Verey <[email protected]>
/lgtm |
/ok-to-test |
So sorry for the delay! /approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: Goodwine, natasha41575 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 |
Context & Description
kyaml currently has no way of updating
ResourceList.Result
unless a custom processor is created by the end user.This PR updates
ResourceList.Filter
used by all current processors so whenever thekio.Filter
returns an error type*Result
it will be assigned toResourceList.Result
instead of erroring out as is the current behavior.This behavior change in
ResourceList.Filter
is a breaking change in the API, I believe this should be OK because IIUC this use case is not adopted widely.Alternative Considered
Instead of special error handling, we can introduce a new
Resulter{ Result(...) (*Result, error) }
interface that can be implemented by the KRM'sFilter()
, but when trying this out it feels very non-idiomatic because in most cases where we want aResulter
we would also have a no-op filter likefunc (myExample) Filter(in) { return in, nil }
.This is also an extra things to be kept in mind from KRM function authors because the interface is not explicitly called out and the behaviors can be unexpected and non idiomatic.
However this does avoid the breaking change.
Workaround
Introduce a new value in
Result.Severity
calledFatal
, theResourceList.Filter
function could verify this value when applicable and throw an actual error instead of keep going.(Or.. we can make erroring out the default behavior but adding a new
Result.NoError
flag to trigger this new behavior.Additional Notes
function/example
that goes with this change but is blocked by this PR being merged because of go-modules