Skip to content

OLM Subscriptions get to ConstraintsNotSatisfiable state when catalog sources are updated  #44

Open
@stonepd

Description

@stonepd

Overview

OLM Subscriptions get in a muddle when catalog sources are updated before the subscription install plan is fully installed.

The applySubscription method in olm.py should detect the related error state when it occurs and rectify the issue by deleting one of the created clusterserviceversion CRs.

Detail

How to identify the problem: The subscription status.conditions list gets an entry like the following:

    "message": "constraints not satisfiable: @existing/ibm-cpd-operators//ibm-cpd-wsl.v9.0.0 and ibm-operator-catalog/openshift-marketplace/v9.0/ibm-cpd-wsl.v9.0.0 originate from package ibm-cpd-wsl, clusterserviceversion ibm-cpd-wsl.v9.0.0 exists and is not referenced by a subscription, subscription cpd-wsl-operator requires ibm-operator-catalog/openshift-marketplace/v9.0/ibm-cpd-wsl.v9.0.0, subscription cpd-wsl-operator exists",
    "reason": "ConstraintsNotSatisfiable",
    "status": "True",
    "type": "ResolutionFailed"
    }

Look for the message "clusterserviceversion ... exists and is not referenced by a subscription"

This happens when the OLM catalog operator handles a subscription, creates a clusterserviceversion but in parallel, the catalog sources are updated (maybe the catalogs are re-released or modified). The status.catalogHealth section of the subscription is updated and when the catalog operator attempts to update the status with a success, the following error is seen in the catalog operator logs

time="2024-09-12T04:02:58Z" level=warning msg="an error was encountered during reconciliation" error="Operation cannot be fulfilled on subscriptions.operators.coreos.com \"openshift-cert-manager-operator\": the object has been modified; please apply your changes to the latest version and try again" event=update reconciling="*v1alpha1.Subscription" selflink=
E0912 04:02:58.521349       1 queueinformer_operator.go:298] sync {"update" "cert-manager-operator/openshift-cert-manager-operator"} failed: Operation cannot be fulfilled on subscriptions.operators.coreos.com "openshift-cert-manager-operator": the object has been modified; please apply your changes to the latest version and try again

(Operation cannot be fulfilled ... the object has been modified)

The result is that there is a valid CSV but it is not linked to the subscription as intended, causing the ConstraintsNotSatisfiable status in the subscription.

A simple solution is to delete the created CSV which is identified in the Subscriptions ConstraintsNotSatisfiable condition, it should be automatically recreated and this time hopefully the subscription will resolve successfully.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions