Bug 2033346

Summary: [cnv-4.10] Add vm name label to virt-launcher pods
Product: Container Native Virtualization (CNV) Reporter: Shirly Radco <sradco>
Component: MetricsAssignee: João Vilaça <jvilaca>
Status: CLOSED ERRATA QA Contact: SATHEESARAN <sasundar>
Severity: high Docs Contact:
Priority: unspecified    
Version: 4.10.0CC: cnv-qe-bugs, kmajcher, phbailey, sgott, stirabos, yzamir
Target Milestone: ---   
Target Release: 4.10.2   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: hco-bundle-registry-container-v4.10.2-5 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2078831 (view as bug list) Environment:
Last Closed: 2022-06-14 17:42:17 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Shirly Radco 2021-12-16 15:12:55 UTC
Description of problem:
We thought we could relay on getting the vm name for the virt-launcher pods, since we have it in the VM templates.But in case the user uses custom templates this label and others might be missing.

We need to make sure we have a label for the vm name attached to the virt-launcher pods, so that we can filter kube-state-metrics by vm-name and join the virt-launcher container metrics with it by the vm name.

Version-Release number of selected component (if applicable):


How reproducible:


Steps to Reproduce:
1.
2.
3.

Actual results:


Expected results:


Additional info:

Comment 1 Krzysztof Majcher 2022-01-14 14:32:56 UTC
It looks like something for Virt team, can you please check?

Comment 2 Yaacov Zamir 2022-01-18 10:22:21 UTC
Hi all,
This is important for UI when displaying the "Top consumer ..." metrics where we want to show users the name of the VM that consume resource and not the name of the launcher pod.
Currently in cases the VM name is missing we fall back to pod name witch is not optimal, @phillipcbailey please keep me honest here.

Comment 3 Yaacov Zamir 2022-01-18 12:25:00 UTC
Opend a BZ to track on the UI side:
https://bugzilla.redhat.com/show_bug.cgi?id=2041865

Comment 4 Phillip Bailey 2022-01-18 14:48:42 UTC
Yaacov, that's correct. =) It would be much more beneficial to the user to display the VM name, especially since we give them the option to view the results by VM. It's going to be a frustrating experience when they realize that the output isn't consistent.

Comment 5 SATHEESARAN 2022-04-22 14:20:21 UTC
Tested with CNV build v4.10.1-86[1] and the VM created with yaml file doesn't have the VM name label for virt-launcher pod.

As I discussed with Joao Vilaca, the fix is available with upstream virt-controller version v0.51,
but the CNV downstream build[1] consists of virt-controller v0.49 and the fix is not available in this build.

Because of the above said reason, this bug is marked FailedQA.
Moving this bug to ASSIGNED 

[1] - http://cnv-version-explorer.apps.cnv.engineering.redhat.com/BundleDetails?ver=v4.10.1-86

Comment 6 SATHEESARAN 2022-06-09 12:42:37 UTC
Verified with the CNV bundle 4.10.2-10 and virt-controller-v4.10.2-1

VM body was build with vm.yaml configuration without the label for VM name.
Following is the VM configuration yaml

<snip>
---
apiVersion: kubevirt.io/v1
kind: VirtualMachine
metadata:
  labels:
  name: vm-cirros
spec:
  running: true 
  template:
    spec:
      domain:
        devices:
          disks:
          - disk:
              bus: virtio
            name: containerdisk
        resources:
          requests:
            memory: 128Mi
      terminationGracePeriodSeconds: 0
      volumes:
      - containerDisk:
          image:  quay.io/kubevirt/cirros-container-disk-demo
        name: containerdisk
</snip>

When creating the vm with the above VM configuration, # oc apply -f <vm.yaml>
then the virt-launcher pod had the label with the vm name

[]$ oc get pods virt-launcher-fedora-sas-template-uptight-skink-jgchw -n openshift -ojson | jq '.metadata.labels' | grep 'vm.kubevirt.io'
  "vm.kubevirt.io/name": "vm-cirros"        <----------- VM name is available in the label

Marking this bug as VERIFIED based on the above verification

Comment 12 errata-xmlrpc 2022-06-14 17:42:17 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: OpenShift Virtualization 4.10.2 Images security and bug fix update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5026