kubevirt
kubevirt copied to clipboard
sync dynamic annotations to virt-launcher pods
What this PR does
KubeVirt is already reconciling a few dynamic labels from VMIs to pods. We have to do the same also for selected annotations: e.g. the annotation used to opt-it/opt-out a pod from the descheduler scope. To correctly close the loop, those selected dynamic annotations should be dynamically synced from spec.template.metadata.annotations on the VM down to the VMI and then to the virt-launcher pod if there.
Before this PR: The annotation used to opt-in/opt-out from the descheduler can already be set on a VMI but its propagated to the virt-launcher pod only when a new VMI and a new virt-launcher pod are rendered (e.g. as a result of a restart).
After this PR:
selected dynamic annotations (currently only descheduler.alpha.kubernetes.io/evict and descheduler.beta.kubernetes.io/evict are reconciled from spec.template.metadata.annotations on the VM object to the VMI and then down to virt-launcher pods.
Fixes #
Why we need it and why it was done in this way
The following tradeoffs were made: This is not generically syncing all the VMI annotations but just a small pre-defined set of annotations.
The following alternatives were considered:
Links to places where the discussion took place:
Special notes for your reviewer
We also have to do the same for that annotation from VM->VMI (or do we prefer to properly expose it under spec and rely on Live Updates???)
Checklist
This checklist is not enforcing, but it's a reminder of items that could be relevant to every PR. Approvers are expected to review this list.
- [ ] Design: A design document was considered and is present (link) or not required
- [X] PR: The PR description is expressive enough and will help future contributors
- [X] Code: Write code that humans can understand and Keep it simple
- [ ] Refactor: You have left the code cleaner than you found it (Boy Scout Rule)
- [ ] Upgrade: Impact of this change on upgrade flows was considered and addressed if required
- [ ] Testing: New code requires new unit tests. New features and bug fixes require at least on e2e test
- [ ] Documentation: A user-guide update was considered and is present (link) or not required. You want a user-guide update if it's a user facing feature / API change.
- [ ] Community: Announcement to kubevirt-dev was considered
Release note
A few dynamic annotations are synced from VMs template to VMIs and to virt-launcher pods
/cc @alaypatel07
/test pull-kubevirt-client-python
/test pull-kubevirt-e2e-k8s-1.30-sig-compute /test pull-kubevirt-e2e-k8s-1.30-sig-network /test pull-kubevirt-e2e-k8s-1.30-sig-operator /test pull-kubevirt-e2e-k8s-1.30-sig-storage /test pull-kubevirt-e2e-k8s-1.31-sig-compute /test pull-kubevirt-e2e-k8s-1.31-sig-network /test pull-kubevirt-e2e-k8s-1.31-sig-operator /test pull-kubevirt-e2e-k8s-1.31-sig-storage /test pull-kubevirt-e2e-k8s-1.32-ipv6-sig-network /test pull-kubevirt-e2e-kind-1.30-vgpu /test pull-kubevirt-e2e-kind-sriov /test pull-kubevirt-e2e-windows2016
@tiraboschi I had an additional requirement very close to what you have in this PR.
There is a need that the dynamic labels to be specified by cluster admins, so that any arbitrary label on the vmi can be kept in sync with the virt-launcher pod. Would you consider adding a commandline flag to virt-controller that provides additional labels to be kept in sync along with the default ones you have in this PR? For reference https://github.com/kubevirt/kubevirt/issues/13761
/hold
@tiraboschi I had an additional requirement very close to what you have in this PR.
There is a need that the dynamic labels to be specified by cluster admins, so that any arbitrary label on the vmi can be kept in sync with the virt-launcher pod. Would you consider adding a commandline flag to virt-controller that provides additional labels to be kept in sync along with the default ones you have in this PR? For reference #13761
/hold
This can be a PR followed this. Is there any other reason to block the PR?
@xpivarc Was trying to see if @tiraboschi can also handle the flag here since is a very small extension.
Please remove hold of this PR has other urgent priorities.
I'll prepare it as a separate commit on top of this.
/unhold I'm addressing the additional requirement (extend the list of synced labels and annotations with a flag to virt-controller) in #14902
/test pull-kubevirt-unit-test-s390x
/test pull-kubevirt-e2e-k8s-1.32-sig-compute /test pull-kubevirt-e2e-k8s-1.31-sig-compute /test pull-kubevirt-e2e-k8s-1.30-sig-compute
@tiraboschi: The specified target(s) for /test were not found.
The following commands are available to trigger required jobs:
/test pull-kubevirt-apidocs
/test pull-kubevirt-build
/test pull-kubevirt-build-arm64
/test pull-kubevirt-build-s390x
/test pull-kubevirt-check-unassigned-tests
/test pull-kubevirt-client-python
/test pull-kubevirt-code-lint
/test pull-kubevirt-e2e-k8s-1.30-sig-compute
/test pull-kubevirt-e2e-k8s-1.30-sig-network
/test pull-kubevirt-e2e-k8s-1.30-sig-operator
/test pull-kubevirt-e2e-k8s-1.30-sig-storage
/test pull-kubevirt-e2e-k8s-1.31-sig-compute
/test pull-kubevirt-e2e-k8s-1.31-sig-monitoring
/test pull-kubevirt-e2e-k8s-1.31-sig-network
/test pull-kubevirt-e2e-k8s-1.31-sig-operator
/test pull-kubevirt-e2e-k8s-1.31-sig-performance
/test pull-kubevirt-e2e-k8s-1.31-sig-storage
/test pull-kubevirt-e2e-k8s-1.32-ipv6-sig-network
/test pull-kubevirt-e2e-k8s-1.32-sig-compute
/test pull-kubevirt-e2e-k8s-1.32-sig-compute-migrations
/test pull-kubevirt-e2e-k8s-1.32-sig-compute-serial
/test pull-kubevirt-e2e-k8s-1.32-sig-network
/test pull-kubevirt-e2e-k8s-1.32-sig-operator
/test pull-kubevirt-e2e-k8s-1.32-sig-storage
/test pull-kubevirt-e2e-kind-1.30-vgpu
/test pull-kubevirt-e2e-kind-sriov
/test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-fossa
/test pull-kubevirt-generate
/test pull-kubevirt-manifests
/test pull-kubevirt-prom-rules-verify
/test pull-kubevirt-unit-test
/test pull-kubevirt-unit-test-s390x
/test pull-kubevirt-verify-go-mod
The following commands are available to trigger optional jobs:
/test build-kubevirt-builder
/test pull-kubevirt-check-dequarantine-test
/test pull-kubevirt-check-tests-for-flakes
/test pull-kubevirt-conformance-arm64
/test pull-kubevirt-e2e-arm64
/test pull-kubevirt-e2e-k8s-1.31-sig-compute-conformance
/test pull-kubevirt-e2e-k8s-1.31-sig-compute-root
/test pull-kubevirt-e2e-k8s-1.31-sig-storage-root
/test pull-kubevirt-e2e-k8s-1.32-sig-compute-realtime
/test pull-kubevirt-e2e-k8s-1.32-sig-network-multus-v4
/test pull-kubevirt-e2e-k8s-1.32-sig-performance-kwok
/test pull-kubevirt-e2e-k8s-1.32-single-node
/test pull-kubevirt-e2e-k8s-1.32-swap-enabled
/test pull-kubevirt-e2e-k8s-1.33-sig-compute
/test pull-kubevirt-e2e-k8s-1.33-sig-compute-serial
/test pull-kubevirt-e2e-k8s-1.33-sig-network
/test pull-kubevirt-e2e-k8s-1.33-sig-operator
/test pull-kubevirt-e2e-k8s-1.33-sig-storage
/test pull-kubevirt-fuzz
/test pull-kubevirt-gosec
/test pull-kubevirt-goveralls
/test pull-kubevirt-metrics-lint
/test pull-kubevirt-unit-test-arm64
/test pull-kubevirt-verify-rpms
Use /test all to run the following jobs that were automatically triggered:
pull-kubevirt-apidocs
pull-kubevirt-build
pull-kubevirt-build-arm64
pull-kubevirt-build-s390x
pull-kubevirt-check-tests-for-flakes
pull-kubevirt-check-unassigned-tests
pull-kubevirt-client-python
pull-kubevirt-code-lint
pull-kubevirt-conformance-arm64
pull-kubevirt-e2e-arm64
pull-kubevirt-e2e-k8s-1.31-sig-performance
pull-kubevirt-e2e-k8s-1.32-sig-compute
pull-kubevirt-e2e-k8s-1.32-sig-compute-migrations
pull-kubevirt-e2e-k8s-1.32-sig-compute-serial
pull-kubevirt-e2e-k8s-1.32-sig-network
pull-kubevirt-e2e-k8s-1.32-sig-operator
pull-kubevirt-e2e-k8s-1.32-sig-storage
pull-kubevirt-fossa
pull-kubevirt-fuzz
pull-kubevirt-generate
pull-kubevirt-goveralls
pull-kubevirt-manifests
pull-kubevirt-prom-rules-verify
pull-kubevirt-unit-test
pull-kubevirt-unit-test-arm64
pull-kubevirt-unit-test-s390x
pull-kubevirt-verify-go-mod
In response to this:
/test pull-kubevirt-e2e-k8s-1.30-sig-networkExpected /test pull-kubevirt-e2e-k8s-1.30-sig-operatorExpected /test pull-kubevirt-e2e-k8s-1.30-sig-storageExpected /test pull-kubevirt-e2e-k8s-1.31-sig-networkExpected /test pull-kubevirt-e2e-k8s-1.31-sig-operatorExpected /test pull-kubevirt-e2e-k8s-1.31-sig-storageExpected /test pull-kubevirt-e2e-k8s-1.32-ipv6-sig-networkExpected /test pull-kubevirt-e2e-kind-1.30-vgpuExpected /test pull-kubevirt-e2e-kind-sriovExpected /test pull-kubevirt-e2e-windows2016Expected
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.
/test pull-kubevirt-e2e-k8s-1.30-sig-network /test pull-kubevirt-e2e-k8s-1.30-sig-operator /test pull-kubevirt-e2e-k8s-1.30-sig-storage /test pull-kubevirt-e2e-k8s-1.31-sig-network /test pull-kubevirt-e2e-k8s-1.31-sig-operator /test pull-kubevirt-e2e-k8s-1.31-sig-storage /test pull-kubevirt-e2e-k8s-1.32-ipv6-sig-network /test pull-kubevirt-e2e-kind-1.30-vgpu /test pull-kubevirt-e2e-kind-sriov /test pull-kubevirt-e2e-windows2016
/test pull-kubevirt-e2e-k8s-1.31-sig-storage
/test pull-kubevirt-e2e-k8s-1.31-sig-storage
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: xpivarc
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~pkg/virt-controller/watch/descheduler/OWNERS~~ [xpivarc]
- ~~pkg/virt-controller/watch/vm/OWNERS~~ [xpivarc]
- ~~pkg/virt-controller/watch/vmi/OWNERS~~ [xpivarc]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
/cc @fossedihelm
/lgtm Thanks
Required labels detected, running phase 2 presubmits: /test pull-kubevirt-e2e-windows2016 /test pull-kubevirt-e2e-kind-1.30-vgpu /test pull-kubevirt-e2e-kind-sriov /test pull-kubevirt-e2e-k8s-1.32-ipv6-sig-network /test pull-kubevirt-e2e-k8s-1.30-sig-network /test pull-kubevirt-e2e-k8s-1.30-sig-storage /test pull-kubevirt-e2e-k8s-1.30-sig-compute /test pull-kubevirt-e2e-k8s-1.30-sig-operator /test pull-kubevirt-e2e-k8s-1.31-sig-network /test pull-kubevirt-e2e-k8s-1.31-sig-storage /test pull-kubevirt-e2e-k8s-1.31-sig-compute /test pull-kubevirt-e2e-k8s-1.31-sig-operator
/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.
/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.
/test pull-kubevirt-goveralls /test pull-kubevirt-e2e-k8s-1.30-sig-compute