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

Intermittent errors from packagevariant #4058

Open
JagratiS opened this issue Oct 11, 2023 · 1 comment
Open

Intermittent errors from packagevariant #4058

JagratiS opened this issue Oct 11, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@JagratiS
Copy link

Expected behavior

Actual behavior

Intermediate errors are coming before ensured package by packagevariant in downstream repo

Information

Errors -

System -
vm - ubuntu
cluster - Kind cluster
kpt version - 1.0.0-beta.44
flux version - flux version 2.1.1
porch - v0.0.27

kubectl get packagevariant test -o yaml

message: 'Internal error occurred: package revision workspaceNames must be unique;
        package revision with name nginxv4-france in repo package-nif-intent with
        workspaceName packagevariant-108 already exists'
message: 'Internal error occurred: Operation cannot be fulfilled on packagerevisionresources.porch.kpt.dev
      "rom-package-variant-1e45707782d551a7284247b086057c20f270cfa9": the object has
      been modified; please apply your changes to the latest version and try again'

After these errors it got success.

kpt alpha rpkg get
test-downstream-repo-a58ef0ad235bee2a5a7670e3e9c1a88b871d8a1f   nginxv1-test   packagevariant-6    main       false    Published   test-downstream-repo
test-upstream-repo-b9b9fb6aa0072054f66a072bccf72bb96b8cfe08     nginx            pv-1                main       false    Published   test-upstream-repo
test-upstream-repo-6fa7341e4e3be245a24af99849b744b2369f371d     nginx            pv-1                v1         true     Published   test-upstream-repo

Can you share any details regarding these errors or is there any issue with my setup?

Steps to reproduce the behavior

@JagratiS JagratiS added the bug Something isn't working label Oct 11, 2023
@johnbelamaric
Copy link
Contributor

johnbelamaric commented Oct 11, 2023

Thanks for the bug report.

In a recent release, we added standard K8s optimistic concurrency controls through proper use of ResourceVersion. That's the second error you are seeing; it indicates that some other client modified the package since you read it. When this happens in PV, the reconciliation loop will try again after a bit; so, it should clear itself up.

That said, we shouldn't see this error as frequently as we do. I think there are a couple possible things we should check:

  • We should make sure that the ResourceVersion being reported for the PackageRevision is the commit hash of the draft branch, or in the case of a Published package, of the tag. If instead it is using the commit hash of HEAD, that could cause this issue if a different package in the same repo were changed. It would probably cause other issues too.
  • Alternatively, it could be that somehow something else is editing the package draft even before the packagevariant gets to it. This could be the nephio-controllers, if you are running this in Nephio. If you are not, then it's not clear what's going on. Looking at the Git history for the package directory may give us a hint, and/or at the PackageRevision task list. Or, do you have another controller running that may be operating on Draft packages?

The first error

        package revision with name nginxv4-france in repo package-nif-intent with
        workspaceName packagevariant-108 already exists

seems to indicate that the second explanation is more likely - it's almost like the PV controller is trying to process it twice, concurrently, with some race condition (the workspace name is generated by the PV controller here: https://github.com/kptdev/kpt/blob/main/porch/controllers/packagevariants/pkg/controllers/packagevariant/packagevariant_controller.go#L645 - that function is called in two places).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants