Bug 2028250

Summary: Multiple CatalogSources causing higher CPU use than necessary
Product: OpenShift Container Platform Reporter: OpenShift BugZilla Robot <openshift-bugzilla-robot>
Component: Telco EdgeAssignee: Ian Miller <imiller>
Telco Edge sub component: ZTP QA Contact: yliu1
Status: CLOSED ERRATA Docs Contact:
Severity: medium    
Priority: unspecified CC: keyoung
Version: 4.10   
Target Milestone: ---   
Target Release: 4.9.z   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-02-23 20:02:50 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2028240    
Bug Blocks:    

Description OpenShift BugZilla Robot 2021-12-01 19:26:56 UTC
+++ This bug was initially created as a clone of Bug #2028240 +++

Description of problem:
The reference ZTP configuration uses a separate CatalogSource for each operator subscription. These operators will all be in the same disconnected registry in the target use case, and are all contained in the redhat-operators registry in connected environments. Using a single CatalogSource for all operators reduces CPU use by olm indexing and liveness/readiness probes.

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


How reproducible: Always


Steps to Reproduce:
1. oc get CatalogSource -A on ZTP installed system

Actual results:
5 CatalogSources are reported


Expected results: 1 CatalogSource


Additional info:

Comment 3 yliu1 2022-01-21 18:12:09 UTC
Verification with v4.9.0-18 ztp-site-generator container image. 
Looks like example is updated, but referenced source-crs are not added to release-4.9 branch:
https://github.com/openshift-kni/cnf-features-deploy/blob/release-4.9/ztp/gitops-subscriptions/argocd/resource-hook-example/policygentemplates/common-ranGen.yaml#L62

Does not have it in source-crs:
https://github.com/openshift-kni/cnf-features-deploy/commits/release-4.9/ztp/source-crs


# Error syncing policies app:

ztp-hooks.watcher 2022-01-21 18:03:52 UTC [DEBUG]             [watcher:135]: Objects to delete are: ['group-du-sno', 'worker-2', 'common']
ztp-hooks.watcher 2022-01-21 18:03:52 UTC [DEBUG]             [watcher:136]: Objects to create/update are: []
ztp-hooks.watcher 2022-01-21 18:03:52 UTC [DEBUG]             [watcher:150]: No objects to update
ztp-hooks.watcher 2022-01-21 18:03:52 UTC [ERROR]             [watcher:85]: PolicyGenWrapper failed: Manifest conversion failed: 2022/01/21 18:03:52 Could not build the entire policy defined by tmpey1hlgod: open /tmp/ztp/source-crs/DefaultCatsrc.yaml: no such file or directory
panic: open /tmp/ztp/source-crs/DefaultCatsrc.yaml: no such file or directory

goroutine 1 [running]:
main.InitiatePolicyGen(0x7ffc5eb0e6fc, 0x17, 0x7ffc5eb0e714, 0x13, 0x7ffc5eb0e728, 0x17, 0xc000100000)
	/go/src/cnf-features-deploy/app/ztp/ztp-policy-generator/kustomize/plugin/policyGenerator/v1/policygenerator/policyGenerator.go:110 +0x1a11
main.main()
	/go/src/cnf-features-deploy/app/ztp/ztp-policy-generator/kustomize/plugin/policyGenerator/v1/policygenerator/policyGenerator.go:28 +0x154
Traceback (most recent call last):
  File "/usr/src/hook/ztp/resource-generator/src/watcher.py", line 83, in __init__
    raise Exception(f"Manifest conversion failed: {output[1].decode()}")
Exception: Manifest conversion failed: 2022/01/21 18:03:52 Could not build the entire policy defined by tmpey1hlgod: open /tmp/ztp/source-crs/DefaultCatsrc.yaml: no such file or directory
panic: open /tmp/ztp/source-crs/DefaultCatsrc.yaml: no such file or directory

goroutine 1 [running]:
main.InitiatePolicyGen(0x7ffc5eb0e6fc, 0x17, 0x7ffc5eb0e714, 0x13, 0x7ffc5eb0e728, 0x17, 0xc000100000)
	/go/src/cnf-features-deploy/app/ztp/ztp-policy-generator/kustomize/plugin/policyGenerator/v1/policygenerator/policyGenerator.go:110 +0x1a11
main.main()
	/go/src/cnf-features-deploy/app/ztp/ztp-policy-generator/kustomize/plugin/policyGenerator/v1/policygenerator/policyGenerator.go:28 +0x154

Comment 6 yliu1 2022-02-01 18:07:39 UTC
Verified with latest 4.9 ztp site generate image using single catalog source.

Comment 9 errata-xmlrpc 2022-02-23 20:02:50 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 Container Platform 4.9.22 security 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:0561