-
Notifications
You must be signed in to change notification settings - Fork 40k
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
kubectl apply retry stale resource version #26557
Conversation
@adohe Thanks, looking. |
return err | ||
} | ||
|
||
func patchResource(p *patcher, current runtime.Object, modified []byte, source, namespace, name string) error { |
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.
Why not make this a function on patcher?
Review pass done. Would you add a test for this? |
Yes, I will update this today. |
Also add a release not label please |
@adohe Send ad PTAL when you want me to take another look |
@adohe Do you plan to have this in before the 1.3 release branch is cut? We are working aggressively on test flakes and it would be good to get this in asap. |
@pwittrock quit sorry about the delay, I will have a short holiday from tomorrow, I can get away from my company stuff, and have more time to do this, I will finish this tomorrow. |
@adohe Thanks. Much appreciated. I don't want to disrupt your holiday if you had other plans. If you don't have time to work on this and would prefer to have some one patch it and finish it let me know. Otherwise I will try to be as responsive as possible when you are working on this tomorrow. |
@pwittrock I just changed the code, ptal. I think the test is a little bit ugly, do you have any good idea? Besides whether we should apply the same to |
Looking. Would be good to do the same for patch, but lets do it as a follow up. |
var getErr error | ||
patchBytes, err := p.patchSimple(current, modified, source, namespace, name) | ||
for i := 0; i < maxPatchRetry && errors.IsConflict(err); i++ { | ||
if p.backOff.IsInBackOffSinceUpdate(backOffKey, p.backOff.Clock.Now()) { |
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.
wow, this is a cool utility. I think it may be overkill for what we are trying to do here, since it seems primarily for synchornizing ratelimits across concurrent routines. At a minimum, we should sleep the backoff duration (sleep p.backOff.Get(backOffKey)). While I really appreciate you showing me this utility, if we don't need the concurrency protection, I think I'd prefer to go with something simpler such as:
Patcher {
...
backoff clockwork.Clock // = clockwork.NewRealClock()
}
...
if i > p.triesBeforeBackoff {
p.backoff.Sleep(p.duration)
}
@adohe The test isn't beautiful, but I don't think it is much worse than the other tests in the same file. I'd leave it and consider cleaning things up a bit in a follow up if there is a clear way of doing so. Low priority. Would love to see the same treatment to patch when you have time. I would do that as a separate PR since it is lower priority than this. Minor comments, otherwise looking good:
|
@pwittrock some mirror thoughts here:
I don't want to delay this PR any further on shaving 1 second of the test time, but in a follow up I would:
SGTM. Thanks.
Don't worry about this for now. Generally, I would like to get to a point where it is simple for us to actually test we are backing off correctly, and this is really best done with a fake clock. I am not sure if the clockwork FakeClock really gives us what we want in this area anyway and we may have to come up with something more tailored to our needs. Ideally calls to sleep would return immediately, but record the sleep call and interval, and then during the test we could query how many times sleep was called and for how long. Definitely not critical right now, but would be good to have. |
@pwittrock thanks for detailed explanation. |
@adohe My pleasure. |
|
seems I can do nothing with this test failed. :( |
@k8s-bot e2e test this issue: #IGNORE Jenkins NPE |
@k8s-bot unit test this issue: #IGNORE never ran |
1 similar comment
@k8s-bot unit test this issue: #IGNORE never ran |
@k8s-bot test this issue: #IGNORE Timeout |
GCE e2e build/test passed for commit 69bcdc2. |
@k8s-bot test this [submit-queue is verifying that this PR is safe to merge] |
GCE e2e build/test passed for commit 69bcdc2. |
Automatic merge from submit-queue |
fixes #15493
@pwittrock I just got my original implementation back, ptal.