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

Restart required correctly propagate #11836

Closed

Conversation

xpivarc
Copy link
Member

@xpivarc xpivarc commented May 2, 2024

What this PR does

This PR fixes cases where RestartRequired condition is not propagated to Kubernetes API. The cause is Update call that should not be called when only .Status is changed (note if a change was made the condition will be missing). Also ensure that we detect a .Status change in the updateStatus.

Fixes #

Special notes for your reviewer

Release note

Bug fix: Correctly reflect RestartRequired condition

Based on #11726

@kubevirt-bot
Copy link
Contributor

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@kubevirt-bot kubevirt-bot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. release-note Denotes a PR that will be considered when it comes time to generate release notes. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels May 2, 2024
@kubevirt-bot kubevirt-bot added size/XXL sig/buildsystem Denotes an issue or PR that relates to changes in the build system. labels May 2, 2024
@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 8, 2024
Removing the `DeepCopy` from updateStatus
allow us to detect changes to the Status inside
the "sync" and acaccurately represent changes.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
VM CRD has a status subresource enabled. This means that
"Update" ignores changes to the status stanza.

Also propagate status changes from "hotplug sync" by returning
the cloned vm.

Signed-off-by: Luboslav Pivarc <lpivarc@redhat.com>
@xpivarc xpivarc force-pushed the restart-required-correctly-propagate branch from f53d55e to 71de121 Compare May 10, 2024 10:19
@kubevirt-bot kubevirt-bot removed needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. size/XXL labels May 10, 2024
@xpivarc xpivarc marked this pull request as ready for review May 10, 2024 10:19
@kubevirt-bot kubevirt-bot added size/L and removed do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels May 10, 2024
Comment on lines +3165 to +3166
} else {
vm = vmCopy
Copy link
Contributor

Choose a reason for hiding this comment

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

That means that if spec/objectmeta changed, we ignore status changes, right?
Example: something above changed both vm.spec and vm.status. We'll call update, which will lose the status changes, and return updatedVm instead of vmCopy.
How about something like that instead?

Suggested change
} else {
vm = vmCopy
}
vm.Status = *vmCopy.Status.DeepCopy()

Copy link
Member Author

Choose a reason for hiding this comment

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

That means that if spec/objectmeta changed, we ignore status changes, right?

Yes, there are couple of edge cases that are not fixed by this PR but the last 3 PRs are making it much more simple to fix these cases. @acardace should have a PR that will fix at least partially these cases.

Example: something above changed both vm.spec and vm.status. We'll call update, which will lose the status changes, and return updatedVm instead of vmCopy.
How about something like that instead?

WDYT about adding equality.Semantic.DeepEqual(vm.Status, vmCopy.Status) && (!equality.Semantic.DeepEqual(vm.Spec, vmCopy.Spec) || !equality.Semantic.DeepEqual(vm.ObjectMeta, vmCopy.ObjectMeta)) { ? But as I said this should be fixed as follow up.

The vm.Status = *vmCopy.Status should not be needed because if the status have changed then no spec changes should be done as well...

Copy link
Contributor

Choose a reason for hiding this comment

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

The vm.Status = *vmCopy.Status should not be needed because if the status have changed then no spec changes should be done as well...

If we know we never change both Status and Spec at the same time, then this is all good!
/approve

Copy link
Member Author

Choose a reason for hiding this comment

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

We do unfortunately but that is bug on its own but the PR doesn't make it worse

@kubevirt-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jean-edouard

The full list of commands accepted by this bot can be found here.

The pull request process is described 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

@kubevirt-bot kubevirt-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label May 10, 2024
@xpivarc
Copy link
Member Author

xpivarc commented May 11, 2024

/cc @fossedihelm

@xpivarc
Copy link
Member Author

xpivarc commented May 11, 2024

/cherry-pick release-1.2

@kubevirt-bot
Copy link
Contributor

@xpivarc: once the present PR merges, I will cherry-pick it on top of release-1.2 in a new PR and assign it to you.

In response to this:

/cherry-pick release-1.2

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.

@kubevirt-bot kubevirt-bot added the lgtm Indicates that a PR is ready to be merged. label May 13, 2024
@kubevirt-commenter-bot
Copy link

Required labels detected, running phase 2 presubmits:
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-k8s-1.30-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-network
/test pull-kubevirt-e2e-k8s-1.28-sig-storage
/test pull-kubevirt-e2e-k8s-1.28-sig-compute
/test pull-kubevirt-e2e-k8s-1.28-sig-operator
/test pull-kubevirt-e2e-k8s-1.29-sig-network
/test pull-kubevirt-e2e-k8s-1.29-sig-storage
/test pull-kubevirt-e2e-k8s-1.29-sig-compute
/test pull-kubevirt-e2e-k8s-1.29-sig-operator

@lyarwood
Copy link
Member

/retest-required

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

2 similar comments
@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@kubevirt-commenter-bot
Copy link

/retest-required
This bot automatically retries required jobs that failed/flaked on approved PRs.
Silence the bot with an /lgtm cancel or /hold comment for consistent failures.

@fossedihelm
Copy link
Contributor

/hold
investigating on the continuous failure

@kubevirt-bot kubevirt-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 14, 2024
@kubevirt-bot
Copy link
Contributor

@xpivarc: 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-kubevirt-e2e-k8s-1.30-sig-compute-migrations 71de121 link true /test pull-kubevirt-e2e-k8s-1.30-sig-compute-migrations

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

@kubevirt-bot kubevirt-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label May 24, 2024
@kubevirt-bot
Copy link
Contributor

PR needs rebase.

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.

@fossedihelm
Copy link
Contributor

Close in favor of
#11973

@acardace acardace closed this May 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. lgtm Indicates that a PR is ready to be merged. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. sig/buildsystem Denotes an issue or PR that relates to changes in the build system. size/L
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants