Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1835001

Summary: ChargeBack reports are not displayed if the metering-operator is installed via OLM to namespace other than `openshift-metering`
Product: OpenShift Container Platform Reporter: Peter Ruan <pruan>
Component: DocumentationAssignee: Sara Thomas <sarthoma>
Status: CLOSED CURRENTRELEASE QA Contact: Peter Ruan <pruan>
Severity: low Docs Contact: Vikram Goyal <vigoyal>
Priority: low    
Version: 4.4CC: aos-bugs, jokerman, kalexand, pruan, spadgett
Target Milestone: ---Keywords: UpcomingSprint
Target Release: 4.5.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: 2021-03-17 20:18:55 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
failed ChargeBack report page none

Description Peter Ruan 2020-05-12 21:00:27 UTC
Created attachment 1687824 [details]
failed ChargeBack report page

Description of problem:
ChargeBack reports are not displayed if the metering-operator is installed via OLM to namespace other than `openshift-metering`.  The installation is successful and I can generate and retrieve a report via the exposed route using CLI.  The report won't display in the webconsole.

pruan@fedora-vm ~/workspace/sandbox/tools/python/jenkins_access (master●)$ display_report_using_exposed_route namespace-memory-usage-now
period_start			period_end			namespace						pod_usage_memory_byte_seconds
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	iscsi-provisioner					122787348480.000000
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	iscsi-provisioner					475535769600.000000
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	local-storage						1392789012480.000000
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	local-storage						5329798348800.000000
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	openshift-ansible-service-broker			330590453760.000000
2020-01-01 00:00:00 +0000 UTC	2020-12-30 23:59:59 +0000 UTC	openshift-ansible-service-broker			1240501616640.000000


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

How reproducible:
Always

Steps to Reproduce:
1. Install metering from Operator Hub into a namespace other than `openshift-metreing`
2. create a report
3. Go to ChargeBack to view the report created.

Actual results:
No report is displayed

Expected results:
Report generated can be viewed.

Additional info:

Comment 1 Zac Herman 2020-05-29 15:40:22 UTC
Actively working this issue and hoping for resolution soon, but will cross into next sprint.

Comment 2 Peter Ruan 2020-05-29 18:13:54 UTC
here's the definition for `display_report_using_exposed_route`


export METERING_NAMESPACE=openshift-metering
function display_report_using_exposed_route {
    export REPORT_NAME="$1"
    export METERING_TOKEN=$(oc -n $METERING_NAMESPACE serviceaccounts get-token reporting-operator)
    export METERING_ROUTE=$(oc -n $METERING_NAMESPACE get route metering -o json | jq -r '.spec.host')
    curl -H "Authorization: Bearer $METERING_TOKEN" -k "https://$METERING_ROUTE/api/v1/reports/get?name=$REPORT_NAME&namespace=$METERING_NAMESPACE&format=tab"
}

Comment 3 Peter Ruan 2020-05-29 19:45:26 UTC
## example report input yaml 
apiVersion: metering.openshift.io/v1alpha1
kind: Report
metadata:
  name: namespace-cpu-usage-now
spec:
  query: "namespace-cpu-usage"
  reportingStart: '2020-01-01T00:00:00Z'
  reportingEnd: '2020-12-31T23:59:59Z'
  runImmediately: true

Comment 4 Samuel Padgett 2020-06-16 16:44:34 UTC
Peter, it's always been a requirement to install metering in the openshift-metering namespace. Console has no way to detect where it's installed otherwise. We should make sure this is clearly documented.

If you follow the instructions it will install in that namespace, but I think we need to clearly call that out as required.

https://docs.openshift.com/container-platform/4.4/metering/metering-installing-metering.html

Moving to the doc component.

Comment 5 Peter Ruan 2020-10-27 19:56:50 UTC
Hi @spadgett,
  You could just probe for any namespaces that have a MeteringConfig CR instantiation.  Can't we also detect it from the `metering` operator installation?  I don’t think it’s looks good if you allow users to install in a namespace of their choosing but the web GUI doesn’t work to show the reports.  I'm not entirely sure this is even a documentation bug either, as we make a strong recommendation that the openshift-metering namespace should be used, but that's not an explicit requirement of ours.

Thanks,
-peter

Comment 8 Sara Thomas 2021-02-24 22:38:56 UTC
@spadgett I added a note to the documentation to (hopefully) clarify this issue for users a little. You can see the preview here under Installing the Metering Operator-->second "i" icon:

https://deploy-preview-29819--osdocs.netlify.app/openshift-enterprise/latest/metering/metering-installing-metering.html#metering-install-operator_installing-metering

Link to github PR: https://github.com/openshift/openshift-docs/pull/29819

Installing the Metering Operator-->second "i" icon.

Please let me know if this change is ok.

Comment 9 Sara Thomas 2021-03-08 21:39:41 UTC
Ready for QA @xtian

Comment 12 Red Hat Bugzilla 2023-09-15 00:31:46 UTC
The needinfo request[s] on this closed bug have been removed as they have been unresolved for 500 days