The setup-instance command fails when operator subscriptions are unbound

The cpd-cli manage setup-instance command installs and upgrades IBM Cloud Pak foundational services and IBM Software Hub. The command fails if any of the operator subscriptions are unbound.

Symptoms

The cpd-cli manage setup-instance command returns the following error:

[✘] Error ...: Timeout after 10 minutes waiting for operator <operator-name> to be upgraded
[ERROR] ... cmd.Run() failed with exit status 1
[ERROR] ... Command exception: The setup-instance command failed (exit status 1). You may find output and logs in the /tmp/work/cpd-cli-workspace/olm-utils-workspace/work directory.
[ERROR] .. RunPluginCommand:Execution error:  exit status 1

Causes

The cpd-cli manage setup-instance command fails because one or more of the following operator subscriptions are not bound to a cluster service version (CSV):
  • cpd-platform-operator
  • ibm-iam-operator
  • ibm-common-service-operator
  • ibm-commonui-operator
  • ibm-namespace-scope-operator
  • operand-deployment-lifecycle-manager

Diagnosing the problem

To confirm that the command failed because the operator subscription is unbound:
  1. Confirm that the operator subscription exists.

    Use the information returned by the cpd-cli manage setup-instance command to determine which operator is affected.

    ibm-common-service-operator subscription
    oc get sub ibm-common-service-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS}
    ibm-namespace-scope-operator subscription
    oc get sub ibm-namespace-scope-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS}
    operand-deployment-lifecycle-manager subscription
    oc get sub operand-deployment-lifecycle-manager \
    --namespace=${PROJECT_CPD_INST_OPERATORS}
  2. Confirm that you see the constraints not satisfiable error in the subscription YAML.
    ibm-common-service-operator subscription
    oc get sub ibm-common-service-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o yaml
    ibm-namespace-scope-operator subscription
    oc get sub ibm-namespace-scope-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o yaml
    operand-deployment-lifecycle-manager subscription
    oc get sub operand-deployment-lifecycle-manager \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o yaml

    Look for the following message:

    message: 'constraints not satisfiable: subscription <subscription-name>
    requires opencloud-operators/operator-ns/v<N.N>/<subscription-name>.v<N.N.N>,
    subscription <subscription-name> exists, clusterserviceversion <subscription-name>.v<N.N.N>
    exists and is not referenced by a subscription, opencloud-operators/operator-ns/v<N.N>/<subscription-name>.v<N.N.N>
    and @existing/operator-ns//<subscription-name>.v<N.N.N> originate from
    package ibm-namespace-scope-operator'
    reason: ConstraintsNotSatisfiable
  3. Check the value of the status.installedCSV field in the subscription:
    ibm-common-service-operator subscription
    oc get sub ibm-common-service-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    ibm-namespace-scope-operator subscription
    oc get sub ibm-namespace-scope-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    operand-deployment-lifecycle-manager subscription
    oc get sub operand-deployment-lifecycle-manager \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    • If the subscription is bound to a CSV, the response has the following format:
      <timestamp> <operator-name>.vN.N.N

      If the subscription is bound, the cpd-cli manage setup-instance command is failing for a different reason. Review the cpd-cli log files to determine the root cause.

    • If the subscription is unbound, the response has the following format:
      <timestamp>

      If the subscription is unbound, continue to Resolving the problem.

Resolving the problem

To resolve the problem:
  1. If you have sufficient permissions to delete pods in the openshift-operator-lifecycle-manager project, restart the catalog-operator pod in the openshift-operator-lifecycle-manager project:
    oc delete $(oc get pods -l app=catalog-operator -o NAME --namespace=openshift-operator-lifecycle-manager) \
    --namespace=openshift-operator-lifecycle-manager
    Note: If you don't have sufficient permissions to delete pods in the openshift-operator-lifecycle-manager project, go to step 3.
  2. Check the value of the status.installedCSV field in the subscription:
    ibm-common-service-operator subscription
    oc get sub ibm-common-service-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    ibm-namespace-scope-operator subscription
    oc get sub ibm-namespace-scope-operator \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    operand-deployment-lifecycle-manager subscription
    oc get sub operand-deployment-lifecycle-manager \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    -o jsonpath='{.metadata.creationTimestamp}{"\t"}{.status.installedCSV}{"\n"}'
    • If the subscription is bound to a CSV, the response has the following format:
      <timestamp> <operator-name>.vN.N.N

      If the subscription is bound to a CSV, rerun the cpd-cli manage setup-instance command.

    • If the subscription is unbound, the response has the following format:
      <timestamp>

      If the subscription is unbound, proceed to the next step.

  3. Get the name of the CSV:
    ibm-common-service-operator CSV
    oc get csv \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    | grep ibm-common-service-operator
    ibm-namespace-scope-operator CSV
    oc get csv \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    | grep ibm-namespace-scope-operator
    operand-deployment-lifecycle-manager CSV
    oc get csv \
    --namespace=${PROJECT_CPD_INST_OPERATORS} \
    | grep operand-deployment-lifecycle-manager
  4. Delete the CSV returned in the preceding step:
    oc delete csv <csv-name> \
    --namespace=${PROJECT_CPD_INST_OPERATORS} 

    Operator Lifecycle Manager (OLM) re-creates the CSV and binds it to the subscription.

  5. Rerun the cpd-cli manage setup-instance command.