operator-framework / operator-lifecycle-manager

A management framework for extending Kubernetes with Operators
https://olm.operatorframework.io
Apache License 2.0
1.72k stars 545 forks source link

e2e - "OLM applies labels to Namespaces that are associated with an OperatorGroup" failure #2575

Open akihikokuroda opened 2 years ago

akihikokuroda commented 2 years ago

Bug Report

e2e - "OLM applies labels to Namespaces that are associated with an OperatorGroup" failed. https://github.com/operator-framework/operator-lifecycle-manager/runs/4858730278?check_suite_focus=true#step:4:2223

------------------------------
Operator Group Given a set of Namespaces Associating these Namespaces with a label when an OperatorGroup is created having matching label selector defined 
  OLM applies labels to Namespaces that are associated with an OperatorGroup
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2291

[BeforeEach] Given a set of Namespaces
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2215
[BeforeEach] Associating these Namespaces with a label
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2252
[BeforeEach] when an OperatorGroup is created having matching label selector defined
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2272
[It] OLM applies labels to Namespaces that are associated with an OperatorGroup
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2291
[AfterEach] Given a set of Namespaces
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2238
[AfterEach] Operator Group
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:35
cleaning up ephemeral test resources...
deleting test subscriptions...
deleting test installplans...
deleting test catalogsources...
deleting test crds...
deleting test csvs...
test resources deleted

• Failure [60.094 seconds]
Operator Group
/home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:34
  Given a set of Namespaces
  /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2206
    Associating these Namespaces with a label
    /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2246
      when an OperatorGroup is created having matching label selector defined
      /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2269
        OLM applies labels to Namespaces that are associated with an OperatorGroup [It]
        /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2291

        Timed out after 60.001s.
        Expected
            <bool>: false
        to be true

        /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2449

        Full Stack Trace
        github.com/operator-framework/operator-lifecycle-manager/test/e2e.pollForNamespaceListCount({0x33270e0, 0xc000beb770}, {{{0x0, 0x0}, {0x0, 0x0}}, {0xc000b04980, 0x3b}, {0x0, 0x0}, ...}, ...)
            /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2449 +0x185
        github.com/operator-framework/operator-lifecycle-manager/test/e2e.glob..func18.13.3.2.2()
            /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/operator_groups_e2e_test.go:2301 +0x18f
        github.com/operator-framework/operator-lifecycle-manager/test/e2e.TestEndToEnd(0xf908f9)
            /home/runner/work/operator-lifecycle-manager/operator-lifecycle-manager/test/e2e/e2e_test.go:59 +0x268
        testing.tRunner(0xc000acc340, 0x3004308)
            /opt/hostedtoolcache/go/1.17.6/x64/src/testing/testing.go:1259 +0x102
        created by testing.(*T).Run
            /opt/hostedtoolcache/go/1.17.6/x64/src/testing/testing.go:1306 +0x35a

What did you do? Check CI build failure What did you expect to see? No error What did you see instead? Under which circumstances? e2e test failure above

Environment

Possible Solution

Additional context Add any other context about the problem here.

akihikokuroda commented 2 years ago

Here is the olm-operator log around the the test.

2022-01-18T20:20:22.749311127Z stderr F time="2022-01-18T20:20:22Z" level=debug msg="No matched TargetNamespaces are found for given selector: labels.internalSelector{labels.Requirement{key:\"foo\", operator:\"=\", strValues:[]string{\"bar\"}}}\n"
2022-01-18T20:20:22.749416128Z stderr F time="2022-01-18T20:20:22Z" level=debug msg="updated target namespaces" namespace=namespace-a-2zwcx operatorGroup=e2e-operator-group-qwhlj targetNamespaces="[]"
2022-01-18T20:20:22.74954053Z stderr F time="2022-01-18T20:20:22Z" level=debug msg="check that operatorgroup has updated CSV anotations" namespace=namespace-a-2zwcx operatorGroup=e2e-operator-group-qwhlj
2022-01-18T20:20:22.752788265Z stderr F time="2022-01-18T20:20:22Z" level=debug msg="OperatorGroup CSV annotation completed" namespace=namespace-a-2zwcx operatorGroup=e2e-operator-group-qwhlj
2022-01-18T20:20:22.770774163Z stderr F time="2022-01-18T20:20:22Z" level=debug msg="operatorgroup clusterroles ensured" namespace=namespace-a-2zwcx operatorGroup=e2e-operator-group-qwhlj

There is no error but this message No matched TargetNamespaces are found for given selector. The syncOperatorGroups didn't see the labels. It is using the namespace lister to get the list of the namespaces. I assume this is cache timing issue.