Bug 1838845 - Metering operator can't connect to postgres DB from Operator Hub
Summary: Metering operator can't connect to postgres DB from Operator Hub
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: Metering Operator
Version: 4.7
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.7.0
Assignee: tflannag
QA Contact: Peter Ruan
URL:
Whiteboard:
Depends On:
Blocks: 1917590
TreeView+ depends on / blocked
 
Reported: 2020-05-21 21:22 UTC by Peter Ruan
Modified: 2024-03-25 15:58 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-02-24 15:01:20 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github kube-reporting metering-operator pull 1465 0 None closed Bug 1838845: Fix Hive metastore deployment with using PostgeSQL as the underlying database 2021-02-03 23:08:39 UTC
Red Hat Product Errata RHSA-2020:5635 0 None None None 2021-02-24 15:02:11 UTC

Internal Links: 1909740

Description Peter Ruan 2020-05-21 21:22:21 UTC
Description of problem:
Metering operator can't connect to postgres DB from Operator Hub even though the installation show all pods are running.



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

How reproducible:
always

Steps to Reproduce:
1. install postgres 10 DB from operator hub
2. expose the postgres service (oc expose svc xxx) and note the cluster ip
2. install metering operator from operator hub
3. configure meteringconfig to use postgres as storage using the following config (replace with cluster ip corresponding to your actual cluster)

apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
  name: operator-metering
  namespace: openshift-metering
spec:
  storage:
    hive:
      type: "s3"
      s3:
        bucket: "qe-metering-pruan-mac"
        region: "us-west-1"
        secretName: "my-aws-secret"
        # Set to false if you want to provide an existing bucket, instead of
        # having Metering create the bucket on your behalf.
        createBucket: true
      type: s3
    type: hive
  reporting-operator:
    spec:
      resources:
        limits:
          cpu: 500m
          memory: 500Mi
        requests:
          cpu: 50m
          memory: 100Mi
  presto:
    spec:
      coordinator:
        resources:
          limits:
            cpu: 1
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 1Gi

  hive:
    spec:
      config:
        db:
          url: "jdbc:postgresql://172.30.60.85:5432/hive"
          driver: "org.postgresql.Driver"
          username: "pruan"
          password: "redhat-2020"
      metastore:
        storage:
          create: false
        resources:
          limits:
            cpu: 2
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 650Mi
      server:
        resources:
          limits:
            cpu: 1
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi




Actual results:
no table created in the `hive` table within psql

postgres=# \l
                                 List of databases
   Name    |  Owner   | Encoding |  Collate   |   Ctype    |   Access privileges   
-----------+----------+----------+------------+------------+-----------------------
 hive      | pruan    | UTF8     | en_US.utf8 | en_US.utf8 | 
 postgres  | postgres | UTF8     | en_US.utf8 | en_US.utf8 | 
 template0 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
 template1 | postgres | UTF8     | en_US.utf8 | en_US.utf8 | =c/postgres          +
           |          |          |            |            | postgres=CTc/postgres
(4 rows)

postgres=# \c hive
You are now connected to database "hive" as user "postgres".
hive=# select current_user;
 current_user 
--------------
 postgres
(1 row)

hive=# \dt
Did not find any relations.


Expected results:
db created with tables.

Additional info:

Comment 1 Peter Ruan 2020-05-21 22:40:17 UTC
metastore container run log

http://pastebin.test.redhat.com/867634

Comment 20 Peter Ruan 2021-02-04 01:38:26 UTC
verified 

$ oc get pods
NAME                                  READY   STATUS      RESTARTS   AGE
hive-metastore-0                      2/2     Running     0          35m
hive-server-0                         3/3     Running     0          35m
metering-operator-748b647694-hhmmj    1/1     Running     0          6h18m
postgresql-1-8x99n                    1/1     Running     0          121m
postgresql-1-deploy                   0/1     Completed   0          121m
presto-coordinator-0                  2/2     Running     0          35m
reporting-operator-6ff56ccc6d-86jw9   2/2     Running     0          34m


apiVersion: metering.openshift.io/v1
kind: MeteringConfig
metadata:
  name: operator-metering
  namespace: openshift-metering
spec:
  storage:
    hive:
      s3:
        bucket: "qe-metering-pruan-mac"
        region: "us-west-1"
        secretName: "my-aws-secret"
        # Set to false if you want to provide an existing bucket, instead of
        # having Metering create the bucket on your behalf.
        createBucket: true
      type: s3
    type: hive
  reporting-operator:
    spec:
      resources:
        limits:
          cpu: 500m
          memory: 500Mi
        requests:
          cpu: 50m
          memory: 100Mi
  presto:
    spec:
      coordinator:
        resources:
          limits:
            cpu: 1
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 1Gi

  hive:
    spec:
      config:
        db:
          url: "jdbc:postgresql://172.30.86.168:5432/hive"
          driver: "org.postgresql.Driver"
          username: "pruan"
          password: "redhat-2020"
          autoCreateMetastoreSchema: false
      metastore:
        storage:
          create: false
        resources:
          limits:
            cpu: 2
            memory: 2Gi
          requests:
            cpu: 500m
            memory: 650Mi
      server:
        resources:
          limits:
            cpu: 1
            memory: 1Gi
          requests:
            cpu: 500m
            memory: 500Mi



starting PostgreSQL 12.5 on x86_64-redhat-linux-gnu

Comment 23 errata-xmlrpc 2021-02-24 15:01:20 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.7.0 extras and 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-2020:5635


Note You need to log in before you can comment on or make changes to this bug.