ibm-mas / cli

Maximo Application Suite command line interface
https://ibm-mas.github.io/cli/
Eclipse Public License 2.0
20 stars 15 forks source link

MAS CLI cannot handle pre-existing OpenShift Pipelines subscription #727

Open marekpolujan opened 5 months ago

marekpolujan commented 5 months ago

Trying to install Manage using pipeline, and the pipeline gets stuck on the first step (pre-install-check) with this error message:

TASK [ibm.mas_devops.ocp_verify : Check Subscription Status] ******************* Checking Subscriptions are up to date (60 retries with a 300 second delay) /opt/app-root/lib64/python3.9/site-packages/urllib3/connectionpool.py:1061: InsecureRequestWarning: Unverified HTTPS request is being made to host '172.30.0.1'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings warnings.warn(

export IBM_ENTITLEMENT_KEY=xxx mas install --mas-catalog-version v8-amd64 --accept-license \ --license-file /scripts/license.dat \ --uds-email 'marek.polujan@ibm.com' --uds-firstname 'Marek' --uds-lastname 'Polujan' \ --storage-rwo 'ocs-storagecluster-ceph-rbd' --storage-rwx 'ocs-storagecluster-cephfs' --storage-pipeline 'ocs-storagecluster-cephfs' --storage-accessmode 'ReadWriteMany' \ --mas-instance-id 'inst1' --mas-workspace-id 'masdev' --mas-workspace-name 'masdev' \ --mas-channel '8.11.x' --non-prod \ --manage-channel 8.7.x \ --manage-jdbc workspace-application --manage-components base=latest,health=latest --manage-demodata \ --db2u-channel v110508.0 --db2u-manage \ --db2u-cpu-request 4000m --db2u-cpu-limit 6000m --db2u-memory-request 8Gi --db2u-memory-limit 12Gi \ --db2u-backup-storage 100Gi --db2u-data-storage 100Gi --db2u-logs-storage 100Gi --db2u-meta-storage 20Gi --db2u-temp-storage 100Gi

durera commented 5 months ago

You whaven't provided any error message. The above is just a warning about use of self-signed certificates.

marekpolujan commented 5 months ago

pre-install-check (3).log

Attached the full log. The error is as follows:

fatal: [localhost]: FAILED! => 
  msg: 'Error: One or more subscriptions did not update to the latest known operator version'

NO MORE HOSTS LEFT *************************************************************

image

durera commented 1 month ago
* openshift-operators/openshift-pipelines-operator = None
* openshift-operators/openshift-pipelines-operator-rh-latest-redhat-operators-openshift-marketplace = AtLatestKnown
*

Looks like you already had openshift-pipelines installed (openshift-pipelines-operator-rh-latest-redhat-operators-openshift-marketplace), and the CLI wasn't smart enough to detect this and installed it's own subscription (openshift-pipelines-operator) .. which could never get healthy (understandably).

Does that sound likely (that you already have openshift pipelines subscription installed via another means)?

If so, this should be reasonably simple for us to provide a fix by adding some logic to check whether there's a subscription for this operator already in place (at the moment it makes a rather large assumption that if there is an existing subscription it is called exactly openshift-pipelines-operator, anything else and you'd end up in the scenario you're in here)

durera commented 3 days ago

For dev working on this, steps to reproduce:

The installer won't find the existing subscription, and will try to create a new one, which will screw everything up.

In the new python-based CLI the issue lies here: https://github.com/ibm-mas/python-devops/blob/7c4e4baab5dcd00d061a693a9d288bf2481b3b51/src/mas/devops/tekton.py#L32

We simply apply the subscription without checking "is there a subscription already by a different name", assuming that the CLI was the creator of any existing subscription.

We should add a check here "is openshift pipelines operator already available, if so then there's nothing to do"