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

Fix race condition where PackageRev CRs are incorrectly deleted #4032

Merged
merged 1 commit into from
Aug 31, 2023

Conversation

mortent
Copy link
Contributor

@mortent mortent commented Aug 31, 2023

We have seen issues where the PackageRev CR that should exist for every PackageRevision suddenly doesn't exist when a PackageRevision is being published. The reason this happens is a race condition between the logic that pushes new refs to the git repository and then updates the internal PackageRevision cache, and the background job that syncs PackageRevisions from git.

If the background job end up running after the new git refs has been pushed, but before the internal cache is updated with the revision assigned to the PackageRevision, the background job is not able to find a PackageRevision in git that matches the PackageRevision key. This is because the PackageRevisions found in git are published and therefore have an assigned revision, while the corresponding PackageRevision in the cache has not been updated with the revision yet.

This fixes this issue by switching the background job to match PackageRevisions based on the kubernetes object name (which doesn't change when a PackageRevision is published), rather than the PackageRevision key.

@mortent mortent requested a review from a team as a code owner August 31, 2023 18:20
@mortent mortent requested a review from droot August 31, 2023 18:20
@mortent mortent merged commit 2277857 into kptdev:main Aug 31, 2023
15 checks passed
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.

None yet

2 participants