Skip to content

Conversation

@tchap
Copy link

@tchap tchap commented Sep 3, 2025

Some errors that can happen when writing resources back during migration are not particularly significant, yet they can cause a lot of log spam.

This change marks some errors coming from the try function to be logged on V(2) so that there are not that many log messages. These include:

  • conflict
  • not found
  • UID precondition failed (effectively a conflict)

Some errors that can happen when writing resources back during migration
are not particularly significant, yet they can cause a lot or log spam.

This change marks some errors coming from the try function to be logged
on V(2) so that there are not that many log messages. These include:

* conflict
* not found
* UID precondition failed (effectively a conflict)
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Sep 3, 2025
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: tchap
Once this PR has been reviewed and has the lgtm label, please assign deads2k for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found 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
Copy link
Contributor

Welcome @tchap!

It looks like this is your first PR to kubernetes-sigs/kube-storage-version-migrator 🎉. Please refer to our pull request process documentation to help your PR have a smooth ride to approval.

You will be prompted by a bot to use commands during the review process. Do not be afraid to follow the prompts! It is okay to experiment. Here is the bot commands documentation.

You can also check if kubernetes-sigs/kube-storage-version-migrator has its own contribution guidelines.

You may want to refer to our testing guide if you run into trouble with your tests not passing.

If you are having difficulty getting your pull request seen, please follow the recommended escalation practices. Also, for tips and tricks in the contribution process you may want to read the Kubernetes contributor cheat sheet. We want to make sure your contribution gets all the attention it needs!

Thank you, and welcome to Kubernetes. 😃

@k8s-ci-robot k8s-ci-robot requested a review from deads2k September 3, 2025 11:10
@k8s-ci-robot k8s-ci-robot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Sep 3, 2025
@k8s-ci-robot
Copy link
Contributor

Hi @tchap. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Sep 3, 2025
Comment on lines +56 to +66
// isUIDPreconditionError checks whether the error contains "Precondition failed: UID in precondition".
// This error message is typically present when the resource is deleted before it can be written back.
func isUIDPreconditionError(err error) bool {
return strings.Contains(err.Error(), "Precondition failed: UID in precondition")
}

// isConflictError checks whether the given error is a conflict error.
// This is true when errors.IsConflict or isUIDPreconditionError returns true.
func isConflictError(err error) bool {
return errors.IsConflict(err) || isUIDPreconditionError(err)
}
Copy link

Choose a reason for hiding this comment

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

If the UID precondition fails, doesn't that imply that the current iteration of the resource was created after the migration started? And if so, is it redundant to "migrate" it?

Copy link
Author

Choose a reason for hiding this comment

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

I think that this issue was originally raised because the migrator was trying to migrate resources that were deleted during migration, so there was a race. So the precondition failed with the stored UID being empty.

Choose a reason for hiding this comment

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

Don't API servers generally return HTTP 404 when that happens? How can it enforce a UID precondition at all if the named object does not exist?

Choose a reason for hiding this comment

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

Is the log spam this PR is trying to address caused by kubernetes/kubernetes#124347?

Copy link
Author

Choose a reason for hiding this comment

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

It seems so, the full error message is the same, just for a different object.

@k8s-ci-robot
Copy link
Contributor

@tchap: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/ok-to-test

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-sigs/prow repository.

@benluddy
Copy link

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Oct 21, 2025
@k8s-ci-robot
Copy link
Contributor

@tchap: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kube-storage-version-migrator-manually-launched-e2e dbf7e08 link true /test pull-kube-storage-version-migrator-manually-launched-e2e

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

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-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants