Skip to content

[Issue-278] Waiter uses watchTools.UntilWithSync instead of Until to handle resource version old error#359

Merged
tomkennedy513 merged 1 commit intomainfrom
issue-278-import-cmd-retry
Dec 20, 2023
Merged

[Issue-278] Waiter uses watchTools.UntilWithSync instead of Until to handle resource version old error#359
tomkennedy513 merged 1 commit intomainfrom
issue-278-import-cmd-retry

Conversation

@fcaroline2020
Copy link
Contributor

Resolves #278

…handle resource version old error

Signed-off-by: Caroline Scherf <fcaroline@vmware.com>
@fcaroline2020 fcaroline2020 requested a review from a team as a code owner September 12, 2023 11:13
Comment on lines +129 to +159
it("recovers from too old resource version error", func() {
watcher.addEvent(watch.Event{
Type: watch.Error,
Object: &v1.Status{
TypeMeta: v1.TypeMeta{
APIVersion: "v1",
Kind: "Status",
},
Status: "Failure",
Message: "too old resource version: 23358 (23360)",
Reason: "Expired",
Code: 410,
},
})

builderObj := &v1alpha2.Builder{
TypeMeta: resourceToWatch.TypeMeta,
ObjectMeta: resourceToWatch.ObjectMeta,
Status: v1alpha2.BuilderStatus{Status: conditionReady(corev1.ConditionTrue, generation)},
}
content, err := runtime.DefaultUnstructuredConverter.ToUnstructured(builderObj)
if err != nil {
panic(err)
}
watcher.addEvent(watch.Event{
Type: watch.Modified,
Object: &unstructured.Unstructured{Object: content},
})

require.NoError(t, waiter.Wait(context.Background(), resourceToWatch))
})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test will fail with the cachetools.Until version with the error message that was first reported. Couldn't force the too old resource version error while testing locally in my cluster :(

@tomkennedy513 tomkennedy513 merged commit 8ed678c into main Dec 20, 2023
@tomkennedy513 tomkennedy513 deleted the issue-278-import-cmd-retry branch December 20, 2023 18:27
neil-hickey pushed a commit to neil-hickey/kpack-cli that referenced this pull request Jan 13, 2026
…/issue-278-import-cmd-retry

[Issue-278] Waiter uses watchTools.UntilWithSync instead of Until to handle resource version old error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KP Import command should be resilient to watcher errors and retry

2 participants