Bug 2033385

Summary: Bug in kubernetes labels that are attached to the CNV logs
Product: Container Native Virtualization (CNV) Reporter: Shirly Radco <sradco>
Component: NetworkingAssignee: oshoval
Status: CLOSED ERRATA QA Contact: Adi Zavalkovsky <azavalko>
Severity: high Docs Contact:
Priority: high    
Version: 4.10.0CC: azavalko, cnv-qe-bugs, fdeutsch, kmajcher, oshoval, phoracek, stirabos
Target Milestone: ---   
Target Release: 4.10.1   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cluster-network-addons-operator v4.10.1-3 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-05-18 20:26:57 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:
Attachments:
Description Flags
screenshot1 none

Description Shirly Radco 2021-12-16 16:18:36 UTC
Created attachment 1846615 [details]
screenshot1

Description of problem:
The Kubernetes common labels,https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/, are attached to the logs but have incorrect values. 
All the logs have Network logs values.


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


How reproducible:


Steps to Reproduce:
1.Set up OCP logging
2.Search for CNV logs in the Discover tab for:
 kubernetes.namespace_name:"openshift-cnv"
3.Check the kubernetes common labels in the log records.

Actual results:
All kubernetes common labels for all CNV log are set based on the Network cnao-operator.

Expected results:
Correct values should be set for each CNV log


Additional info:

Comment 2 Shirly Radco 2021-12-16 16:20:59 UTC
We will need to go over all labels and verify they are correct for each operator.

Comment 3 Erkan Erol 2021-12-17 08:32:45 UTC
The problem is in the labels of namespace. 

$ oc get ns openshift-cnv --show-labels
NAME            STATUS   AGE   LABELS
openshift-cnv   Active   16d   app.kubernetes.io/component=network,app.kubernetes.io/managed-by=hco-operator,app.kubernetes.io/part-of=hyperconverged-cluster,app.kubernetes.io/version=v4.10.0,control-plane=mac-controller-manager,kubernetes.io/metadata.name=openshift-cnv,name=openshift-cnv,networkaddonsoperator.network.kubevirt.io/version=sha256_abcfc9cbb3ff9a0a396f15eed465cdf9b83b08715621c0986deae2f0,olm.operatorgroup.uid/1ead06cb-9311-4f94-841b-2e93a48947cf=,olm.operatorgroup.uid/86e616d1-1387-4084-8c71-14a656760e4a=,openshift.io/cluster-monitoring=true,prometheus.cnao.io=true


The log collector attaches labels of namespace as `kubernetes.namespace_labels` into the logs. That is why all logs seem belong to network component. I agree that we need to fix the labels of namespace.


On the other hand, as shown in the screenshots, labels of pods are correct and they are available in "kubernetes.flat_labels" field. When you use the correct field in filtering, there is no issue.

Comment 5 Petr Horáček 2022-01-20 12:15:01 UTC
@

Comment 6 Petr Horáček 2022-01-20 12:16:45 UTC
Shirly, it is not clear to me from the description whether it is us setting the label or if it is a higher-level component doing it. Could you shed some light on that and help us understand how we could help fix this from the network side?

Comment 7 Shirly Radco 2022-01-24 10:11:21 UTC
It seems Network is setting the namespace labels.
This affects all the rest of the operators of the openshift-cnv namspace logs.

Comment 8 Petr Horáček 2022-02-03 12:14:21 UTC
Blockers only: Moving to 4.10.1

Comment 10 oshoval 2022-03-17 12:39:36 UTC
backport PR
https://github.com/kubevirt/cluster-network-addons-operator/pull/1277
U/S release-0.65

Comment 11 oshoval 2022-03-31 08:50:36 UTC
Please find in the PR desc the list of the labels that were removed
https://github.com/kubevirt/cluster-network-addons-operator/pull/1145

Comment 12 Adi Zavalkovsky 2022-04-06 13:18:00 UTC
Verified.
Openshift version 4.10.8
cluster-network-addons-operator	v4.10.1-3

Labels mentioned in https://github.com/kubevirt/cluster-network-addons-operator/pull/1145 do not appear on openshift-cnv ns:
[cnv-qe-jenkins@n-adiz410n-prrv5-executor ~]$ oc get ns openshift-cnv -o yaml
apiVersion: v1
kind: Namespace
metadata:
  annotations:
    openshift.io/node-selector: ""
    openshift.io/sa.scc.mcs: s0:c26,c15
    openshift.io/sa.scc.supplemental-groups: 1000680000/10000
    openshift.io/sa.scc.uid-range: 1000680000/10000
  creationTimestamp: "2022-04-06T12:33:52Z"
  labels:
    kubernetes.io/metadata.name: openshift-cnv
    name: openshift-cnv
    olm.operatorgroup.uid/dd7343ad-1aa9-4a32-8562-daad676de9ae: ""
    olm.operatorgroup.uid/f2fe655d-22ae-4493-bafe-5452d24da48d: ""
    openshift.io/cluster-monitoring: "true"
  name: openshift-cnv
  resourceVersion: "76119"
  uid: b9681365-6fbd-4d46-9655-4514754a602a
spec:
  finalizers:
  - kubernetes
status:
  phase: Active

Comment 18 errata-xmlrpc 2022-05-18 20:26:57 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.1 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:4668