Watching multiple namespaces from a single namespace installation

Set up the ability to watch multiple target namespaces from your Db2® Operator namespace.

About this task

Prior to the 11.5.7-cn5 release of Db2, users had two deployment options for the Db2 Operator:
  • Installation at the cluster level, to view all namespaces. This option, which is now deprecated, allowed users to create Db2 instances in any namespace within a cluster.
  • Installation at the namespace level, to view a single namespace. This method limits the user's control to a single namespace.
You must configure a ConfigMap to watch namespaces outside of the one where the Db2 Operator is installed.

Procedure

  1. From your Red Hat OpenShift console, create a ConfigMap resource named namespace-scope in the namespace where the Db2 Operator is installed.
    kind: ConfigMap
    apiVersion: v1
    metadata:
      name: namespace-scope
      namespace: <db2u_operator_ns>
    data:
      namespaces: '<db2u_operator_ns>,<target_ns_1>,<target_ns_2>'
  2. Set an environment variable for the namespace where the Db2 Operator is installed:
    NAMESPACE=<db2u_operator_ns>
    If the Db2 Operator namespace is openshift-operators:
    Restart the Db2 Operator by deleting the pod:
    kubectl delete $(kubectl get po -oname -n $NAMESPACE| grep -i db2u-operator-manager) -n $NAMESPACE
    Check if the Db2 Day 2 operator pod exists (as of v110508.0.1):
    kubectl get po -oname -n $NAMESPACE | grep -i db2u-day2-ops
    If this command returns a value, then delete the pod:
    kubectl delete $(kubectl get po -oname -n $NAMESPACE | grep -i db2u-day2-ops) -n $NAMESPACE
    If the Db2 Operator namespace is not openshift-operators:
    Edit the OperatorGroup resource db2u-operator-group. By adding the target namespaces to this resource, you give the Db2 Operator permissions in the target namespaces.
    kubectl edit OperatorGroup db2u-operator-group -n $NAMESPACE 
    Edit the spec.targetNamespaces field by adding the namespaces to be watched:
    targetNamespaces:
        - db2u_operator_ns
        - target_ns_1
        - target_ns_2
  3. Save your changes and exit.
    You can now see the target namespaces from your Db2 Operator namespace.