Bug 1770051

Summary: MongoDB Operator does not set OPS_MANAGER_IMAGE_REPOSITORY and OPS_MANAGER_IMAGE_PULL_POLICY env vars
Product: OpenShift Container Platform Reporter: Bruno Andrade <bandrade>
Component: ISV OperatorsAssignee: Jose R. Gonzalez <jogonza>
Status: CLOSED ERRATA QA Contact: Tom Buskey <tbuskey>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.3.0CC: aos-bugs, aprajapa, jiazha, jogonza, scolange, sd-ecosystem, tbuskey
Target Milestone: ---   
Target Release: 4.3.0   
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: 2020-04-30 01:28:07 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:

Description Bruno Andrade 2019-11-08 01:46:44 UTC
Description of problem:
As shown on https://github.com/mongodb/mongodb-enterprise-kubernetes/blob/master/mongodb-enterprise.yaml#L210-L213 , OPS_MANAGER_IMAGE_REPOSITORY and OPS_MANAGER_IMAGE_PULL_POLICY are mandatory fields to create MongoDB Ops Manager CRs, which are not available at the current operator.

oc get pods mongodb-enterprise-operator-76c85b7cfd-hgbg4 -o yaml | grep -A20 env

  - env:
    - name: WATCH_NAMESPACE
      valueFrom:
        fieldRef:
          apiVersion: v1
          fieldPath: metadata.annotations['olm.targetNamespaces']
    - name: MANAGED_SECURITY_CONTEXT
      value: "false"
    - name: OPERATOR_ENV
      value: prod
    - name: MONGODB_ENTERPRISE_DATABASE_IMAGE
      value: registry.connect.redhat.com/mongodb/enterprise-database:1.2.3
    - name: IMAGE_PULL_POLICY
      value: Always

I had to set them manually at the subscription to get it working.

apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: mongodb-enterprise
  namespace: mongodb
spec:
  channel: stable
  config:
    env:
      - name: OPS_MANAGER_IMAGE_REPOSITORY
        value: quay.io/mongodb/mongodb-enterprise-ops-manager
      - name: OPS_MANAGER_IMAGE_PULL_POLICY
        value: Always
  installPlanApproval: Automatic
  name: mongodb-enterprise
  source: certified-operators
  sourceNamespace: openshift-marketplace

Version-Release number of selected component (if applicable):
 oc get pods mongodb-enterprise-operator-76c85b7cfd-hgbg4 -o yaml | grep image:
    image: registry.connect.redhat.com/mongodb/enterprise-operator:1.2.3
    image: registry.connect.redhat.com/mongodb/enterprise-operator:1.2.3
MongoDB Operator: 1.2.4

OCP Cluster: 4.3.0-0.nightly-2019-11-07-062654

How reproducible: Always


Steps to Reproduce:
1. Install MongoDB Operator 
2. Create ops-manager-admin-secret 
3. Create MongoDB Ops Manager

Actual results: 
OPS_MANAGER_IMAGE_REPOSITORY and OPS_MANAGER_IMAGE_PULL_POLICY env vars are not added on operator definition.

Expected results:
The mandatory environment variables should be added at the operator definition 

Additional info:

Comment 1 Jose R. Gonzalez 2019-11-08 22:56:08 UTC
Confirmed. Based on what I'm seeing, this needs to exist in the CSV. 

I've reached out to the MongoDB team for visibility. I'll work with them to get PRs submitted if they also confirm this is a misconfiguration in the CSV only.

Comment 2 Jose R. Gonzalez 2019-11-12 16:33:06 UTC
This has been merged in the upstream operator[1]. Will be pending the same to the certified operators. 



[1]https://github.com/operator-framework/community-operators/commit/587e8fcc4679f07e0ba2e8085aadbfe807f3434c

Comment 5 Jose R. Gonzalez 2020-04-15 20:52:31 UTC
MongoDB's certified operator version 1.4.5 has been released which should resolve this issue. 

The ClusterServiceVersion for the operator is now exposing mandatory environment variables OPS_MANAGER_IMAGE_PULL_POLICY and OPS_MANAGER_IMAGE_REPOSITORY to the operator deployment/pod as expected.

Comment 6 Tom Buskey 2020-04-17 17:15:23 UTC
oc version
Client Version: openshift-clients-4.4.0-202004040654
Server Version: 4.4.0-0.nightly-2020-04-17-044622
Kubernetes Version: v1.17.1

oc get pod $POD -o yaml

   - name: MONGODB_ENTERPRISE_DATABASE_IMAGE
      value: registry.connect.redhat.com/mongodb/enterprise-database:1.4.5
   - name: IMAGE_PULL_POLICY
      value: Always
    - name: OPS_MANAGER_IMAGE_REPOSITORY
      value: registry.connect.redhat.com/mongodb/mongodb-enterprise-ops-manager
    - name: OPS_MANAGER_IMAGE_PULL_POLICY
      value: Always


Web console:
mongodb-enterprise.v1.4.5

--------------

oc version
Client Version: openshift-clients-4.3.11-202004040552-2-g4fb2d4d9
Server Version: 4.3.12
Kubernetes Version: v1.16.2

   - name: OPS_MANAGER_IMAGE_REPOSITORY
      value: registry.connect.redhat.com/mongodb/mongodb-enterprise-ops-manager
    - name: OPS_MANAGER_IMAGE_PULL_POLICY
      value: Always
    - name: APP_DB_IMAGE_REPOSITORY
      value: registry.connect.redhat.com/mongodb/mongodb-enterprise-appdb
    image: registry.connect.redhat.com/mongodb/enterprise-operator:1.4.5


Web console:
mongodb-enterprise.v1.4.5

Comment 9 errata-xmlrpc 2020-04-30 01:28:07 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, 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/RHBA-2020:1529