kubevirt icon indicating copy to clipboard operation
kubevirt copied to clipboard

sync dynamic annotations to virt-launcher pods

Open tiraboschi opened this issue 6 months ago • 9 comments

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.

Release note

A few dynamic annotations are synced from VMs template to VMIs and to virt-launcher pods

tiraboschi avatar May 16 '25 12:05 tiraboschi

/cc @alaypatel07

vladikr avatar Jun 03 '25 16:06 vladikr

/test pull-kubevirt-client-python

tiraboschi avatar Jun 05 '25 06:06 tiraboschi

/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 avatar Jun 06 '25 16:06 tiraboschi

@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

alaypatel07 avatar Jun 07 '25 12:06 alaypatel07

@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 avatar Jun 09 '25 13:06 xpivarc

@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.

alaypatel07 avatar Jun 09 '25 13:06 alaypatel07

I'll prepare it as a separate commit on top of this.

tiraboschi avatar Jun 09 '25 14:06 tiraboschi

/unhold I'm addressing the additional requirement (extend the list of synced labels and annotations with a flag to virt-controller) in #14902

tiraboschi avatar Jun 10 '25 13:06 tiraboschi

/test pull-kubevirt-unit-test-s390x

tiraboschi avatar Jun 16 '25 15:06 tiraboschi

/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 avatar Jun 18 '25 21:06 tiraboschi

@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.

kubevirt-bot avatar Jun 19 '25 08:06 kubevirt-bot

/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

tiraboschi avatar Jun 19 '25 10:06 tiraboschi

/test pull-kubevirt-e2e-k8s-1.31-sig-storage

tiraboschi avatar Jun 19 '25 18:06 tiraboschi

/test pull-kubevirt-e2e-k8s-1.31-sig-storage

tiraboschi avatar Jun 20 '25 08:06 tiraboschi

[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

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 avatar Jun 23 '25 15:06 kubevirt-bot

/cc @fossedihelm

xpivarc avatar Jun 23 '25 15:06 xpivarc

/lgtm Thanks

fossedihelm avatar Jun 24 '25 07:06 fossedihelm

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

kubevirt-commenter-bot avatar Jun 24 '25 07:06 kubevirt-commenter-bot

/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 avatar Jun 24 '25 09:06 kubevirt-commenter-bot

/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 avatar Jun 24 '25 11:06 kubevirt-commenter-bot

/test pull-kubevirt-goveralls /test pull-kubevirt-e2e-k8s-1.30-sig-compute

tiraboschi avatar Jun 24 '25 12:06 tiraboschi