Bug 1994648

Summary: Resolution failed error condition in Subscription not being removed after resolution error is resolved.
Product: OpenShift Container Platform Reporter: Anik <anbhatta>
Component: OLMAssignee: Joe Lanford <jlanford>
OLM sub component: OLM QA Contact: xzha
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: davegord, tflannag
Version: 4.9   
Target Milestone: ---   
Target Release: 4.9.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: 2021-10-18 17:47:03 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 Anik 2021-08-17 15:50:26 UTC
Description of problem:

When a Subscription fails due to any dependency resolution error, a condition in the subscription captures the reason for the error in it's message. However, when the error is resolved, the condition status (true) and the message
sticks around. The condition status should be set to false, and the message and reason of the condition should be cleared off.

Version-Release number of selected component (if applicable):

4.9

How reproducible:

Always 

Steps to Reproduce:
1. Create a subscription for an operator to a non-existing CatalogSource 
2. Check for the following condition in the Subscription: 

- message: 'constraints not satisfiable: no operators found from catalog operatorhubio-catalog
        in namespace olm referenced by subscription lib-bucket, subscription lib-bucket
        exists'
      reason: ConstraintsNotSatisfiable
      status: "True"
      type: ResolutionFailed

3. Create the CatalogSource that provides the operator that the Subscription specifies

Actual results:

Subscription succeeds, with the operator being installed, but the condition is not removed/reset 

Expected results:

The condition is reset when the operator is installed, otherwise the Subscription conveys an erroneous message that the operator has not been installed. 


Additional info:

Comment 5 xzha 2021-08-27 08:42:20 UTC
verify:

zhaoxia@xzha-mac ditto % oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.9.0-0.nightly-2021-08-26-164418   True        False         67m     Cluster version is 4.9.0-0.nightly-2021-08-26-164418
zhaoxia@xzha-mac ditto % oc exec catalog-operator-6467c8664f-wpgpr -- olm --version
OLM version: 0.18.3
git commit: 859291e1cd7486e3f3a93b19b5133b7432239900

1, install sub
zhaoxia@xzha-mac ditto % cat sub_ditto.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: ditto-operator
  namespace: test-1
spec:
  channel: "alpha"
  installPlanApproval: Automatic 
  name: ditto-operator
  source: ditto-operator-index 
  sourceNamespace: openshift-marketplace

zhaoxia@xzha-mac ditto % oc apply -f sub_ditto.yaml
subscription.operators.coreos.com/ditto-operator created
zhaoxia@xzha-mac ditto % oc get sub
NAME             PACKAGE          SOURCE                 CHANNEL
ditto-operator   ditto-operator   ditto-operator-index   alpha

zhaoxia@xzha-mac ditto % oc get sub -o yaml
apiVersion: v1
items:
- apiVersion: operators.coreos.com/v1alpha1
  kind: Subscription
    name: ditto-operator
    namespace: test-1
   ......
    conditions:
    - lastTransitionTime: "2021-08-27T08:29:41Z"
      message: targeted catalogsource openshift-marketplace/ditto-operator-index missing
      reason: UnhealthyCatalogSourceFound
      status: "True"
      type: CatalogSourcesUnhealthy
    - message: 'constraints not satisfiable: no operators found from catalog ditto-operator-index
        in namespace openshift-marketplace referenced by subscription ditto-operator,
        subscription ditto-operator exists'
      reason: ConstraintsNotSatisfiable
      status: "True"
      type: ResolutionFailed
    lastUpdated: "2021-08-27T08:29:43Z"
""

2, install catalog
zhaoxia@xzha-mac ditto % cat catsrc3.yaml 
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: ditto-operator-index
  namespace: openshift-marketplace
spec:
  displayName: Test
  publisher: OLM-QE
  sourceType: grpc
  image: quay.io/olmqe/ditto-index:v1-4.8
  updateStrategy:
    registryPoll:
      interval: 10m
zhaoxia@xzha-mac ditto % oc apply -f catsrc3.yaml 
catalogsource.operators.coreos.com/ditto-operator-index created
zhaoxia@xzha-mac ditto % oc get catsrc -A
NAMESPACE               NAME                   DISPLAY               TYPE   PUBLISHER   AGE
openshift-marketplace   certified-operators    Certified Operators   grpc   Red Hat     81m
openshift-marketplace   community-operators    Community Operators   grpc   Red Hat     81m
openshift-marketplace   ditto-operator-index   Test                  grpc   OLM-QE      10s
openshift-marketplace   redhat-marketplace     Red Hat Marketplace   grpc   Red Hat     81m
openshift-marketplace   redhat-operators       Red Hat Operators     grpc   Red Hat     81m

3, check sub condition
zhaoxia@xzha-mac ditto % oc get csv
NAME                    DISPLAY         VERSION   REPLACES                PHASE
ditto-operator.v0.2.0   Eclipse Ditto   0.2.0     ditto-operator.v0.1.1   Succeeded
zhaoxia@xzha-mac ditto % oc get sub ditto-operator -o yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"operators.coreos.com/v1alpha1","kind":"Subscription","metadata":{"annotations":{},"name":"ditto-operator","namespace":"test-1"},"spec":{"channel":"alpha","installPlanApproval":"Automatic","name":"ditto-operator","source":"ditto-operator-index","sourceNamespace":"openshift-marketplace"}}
  creationTimestamp: "2021-08-27T08:29:27Z"
  generation: 1
  labels:
    operators.coreos.com/ditto-operator.test-1: ""
  name: ditto-operator
  namespace: test-1
  resourceVersion: "46887"
  uid: 82cb10ed-ed67-4869-b7f0-b98a82e8c1a5
......
  conditions:
  - lastTransitionTime: "2021-08-27T08:30:47Z"
    message: all available catalogsources are healthy
    reason: AllCatalogSourcesHealthy
    status: "False"
    type: CatalogSourcesUnhealthy
  - status: "False"
    type: ResolutionFailed
  currentCSV: ditto-operator.v0.2.0
  installPlanGeneration: 1
  installPlanRef:
    apiVersion: operators.coreos.com/v1alpha1
    kind: InstallPlan
    name: install-zfvvs
    namespace: test-1
    resourceVersion: "46667"
    uid: cd76cdfd-49e0-4c30-89e8-4ce64a003bf3
  installedCSV: ditto-operator.v0.2.0
  installplan:
    apiVersion: operators.coreos.com/v1alpha1
    kind: InstallPlan
    name: install-zfvvs
    uuid: cd76cdfd-49e0-4c30-89e8-4ce64a003bf3
  lastUpdated: "2021-08-27T08:31:02Z"
  state: AtLatestKnown


LGTM, verified.

Comment 8 errata-xmlrpc 2021-10-18 17:47:03 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 (Moderate: OpenShift Container Platform 4.9.0 bug fix and security update), 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/RHSA-2021:3759