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

Boskos: Retry on conflict #16529

Merged

Conversation

alvaroaleman
Copy link
Member

This PR adds retrying on conflicts to the boskos handlers, in order to resolve the occasional the object has been modified; please apply your changes to the latest version and try again errors we are seeing and that will presumably vastly increase once we remove the global lock.

Fixes https://github.com/openshift/release/issues/7183

/assign @ixdy @bbguimaraes

@k8s-ci-robot
Copy link
Contributor

@alvaroaleman: GitHub didn't allow me to assign the following users: bbguimaraes.

Note that only kubernetes members, repo collaborators and people who have commented on this issue/PR can be assigned. Additionally, issues/PRs can only have 10 assignees at the same time.
For more information please see the contributor guide

In response to this:

This PR adds retrying on conflicts to the boskos handlers, in order to resolve the occasional the object has been modified; please apply your changes to the latest version and try again errors we are seeing and that will presumably vastly increase once we remove the global lock.

Fixes https://github.com/openshift/release/issues/7183

/assign @ixdy @bbguimaraes

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 k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 27, 2020
@k8s-ci-robot k8s-ci-robot added area/boskos Issues or PRs related to code in /boskos sig/testing Categorizes an issue or PR as relevant to SIG Testing. labels Feb 27, 2020
@alvaroaleman
Copy link
Member Author

/cc @bbguimaraes

@k8s-ci-robot
Copy link
Contributor

@alvaroaleman: GitHub didn't allow me to request PR reviews from the following users: bbguimaraes.

Note that only kubernetes members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

/cc @bbguimaraes

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.

Copy link
Member

@ixdy ixdy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this somewhat feels weird to me, like the abstraction is leaking - why have the handlers do retries rather than putting that into the ranch implementation? (this is arguably easier, probably - the ranch functions are very long.)

@@ -390,3 +410,35 @@ func handleMetric(r *ranch.Ranch) http.HandlerFunc {
res.Write(js)
}
}

// retryOnConflict is a copy of https://godoc.org/k8s.io/client-go/util/retry#RetryOnConflict
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it looks like this is really a copy of retry.OnError except that you curried the retriable parameter.

Couldn't we instead do this?

func retryOnConflict(backoff wait.Backoff, fn func() error) error {
	return retry.OnError(backoff, isConflict, fn)
}

Or am I missing something?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, retry.RetryOnError is not available in the client-go version we currently use. I am working on another PR that will also bump the kube dependencies, once that is in I could change this to use retry.OnError: #16524

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you working on a follow-up PR now that #16524 is in?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to answer my own question: #16698

@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 28, 2020
@alvaroaleman
Copy link
Member Author

this somewhat feels weird to me, like the abstraction is leaking - why have the handlers do retries rather than putting that into the ranch implementation? (this is arguably easier, probably - the ranch functions are very long.)

That is a very good point, updated the PR accordingly. Good you caught this, because we do the locking within ranch, so the retying on handler level would have meant that we might have to acquire the lock multiple times for a single request 😬

I also added retrying to SyncResources, which required me to adjust the error propagation a bit so we can still properly recognize conflicts.

@alvaroaleman alvaroaleman changed the title Boskos handlers: Retry on conflict Boskos: Retry on conflict Feb 28, 2020

// retryOnConflict is a copy of https://godoc.org/k8s.io/client-go/util/retry#RetryOnConflict
// that only differs in the isConflict check, we use a variant that supports wrapped errors.
// TODO: Simplify this by using retry.OnError once we have a sufficiently new client-go dependency
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want a tracking issue on this

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

[APPROVALNOTIFIER] This PR is APPROVED

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

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 Mar 2, 2020
@k8s-ci-robot k8s-ci-robot merged commit bd87a79 into kubernetes:master Mar 2, 2020
@k8s-ci-robot k8s-ci-robot added this to the v1.18 milestone Mar 2, 2020
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. area/boskos Issues or PRs related to code in /boskos 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. sig/testing Categorizes an issue or PR as relevant to SIG Testing. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[boskos] failed to update resources ... after patching it
4 participants