Incorrect EDB Postgres operator environment variable configuration

When you upgrade IBM Cloud Pak foundational services version 3.12.x or older to newer version, to deploy EDB Postgres, you need to manually update the common-service NamesapceScope Custom Resource (CR) to correctly configure the EDB Postgres environment variable.

Symptom

After upgrade, cloud-native-postgresql does not work correctly in namespaces other than ibm-comon-services namespace.

To check the cloud-native-postgresql CSV, run the following command:

oc get csv <cloud-native-postgresql-name> -n <EDB-installed-namespace> -oyaml

The cloud-native-postgresql CSV has the following configuration for `WATCH_NAMESPACE:

env:
- name: WATCH_NAMESPACE
  valueFrom:
    fieldRef:
    fieldPath: 'metadata.annotations[''olm.targetNamespaces'']'

Cause

This is a known limitation for updating the common-service NamesapceScope CR from old version of IBM Cloud Pak foundational services. CSVInjector is not enabled by default in NamespaceScope CR.

Resolving the problem

Complete the following steps to resolve the issue:

  1. Edit the common-service NamespaceScope CR to enable the CSVInjector by running the following command:

    1. Open the CR for editing.

      oc edit namespacescope common-service -n <NamsapceScope-operator-installed-namespace>
      
    2. Add CSVInjector enabled under spec section in the custom resource

      spec:
        csvInjector:
            enable: true
      
    3. Save the changes and close the CR.

  2. Run the following command to re-install the EDB Postgres operator.

    1. Uninstall the existing EDB Postgres operator.

      oc delete sub cloud-native-postgresql -n <EDB-installed-namespace>
      oc delete csv <cloud-native-postgresql-name> -n <EDB-installed-namespace>
      
    2. Restart the ODLM pod to re-install EDB Postgres operator,

      oc delete pod -l name=operand-deployment-lifecycle-manager -n <ODLM-installed-namespace>