Bug 1886448 - CSV with only Webhook conversion can't be installed
Summary: CSV with only Webhook conversion can't be installed
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.6
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.6.z
Assignee: Alexander Greene
QA Contact: kuiwang
URL:
Whiteboard:
Depends On: 1885398
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-10-08 13:24 UTC by OpenShift BugZilla Robot
Modified: 2020-11-30 16:46 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-30 16:45:28 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github operator-framework operator-lifecycle-manager pull 1802 0 None closed [release-4.6] Bug 1886448: Retrieve CA from conversion webhooks for CA Hash 2020-12-16 22:51:40 UTC
Red Hat Product Errata RHBA-2020:5115 0 None None None 2020-11-30 16:46:18 UTC

Description OpenShift BugZilla Robot 2020-10-08 13:24:58 UTC
+++ This bug was initially created as a clone of Bug #1885398 +++

Description of problem:
A CSV with only a Conversion Webhook and no other Mutating/Validating  Wenhooks can't be installed.
Installation will be stuck in the loop: ReadyToInstall ->Installing -> Pending -> ReadyToInstall

The only info in events is:
"calculated deployment install is bad"

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

How reproducible:
100%

Steps to Reproduce:
1. Deploy an operator having a CSV only with a Webhook Conversion.


Additional info:
The root cause  is hidden by:
   https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/operators/olm/operator.go#L1535
that hides the actual error.
In this case the cause was a missing flow in:
   https://github.com/operator-framework/operator-lifecycle-manager/blob/master/pkg/controller/operators/olm/apiservices.go#L264
It does not handle the desc.Type == v1alpha1.ConversionWebhook case.

--- Additional comment from mapfelba on 2020-10-05 19:46:15 UTC ---

Created attachment 1719144 [details]
Proposed patch

Proposed by Alexander Greene
Verified by Marcel Apfelbaum

Comment 5 kuiwang 2020-11-23 05:02:52 UTC
verify it on 4.6. LGTM

--
[root@preserve-olm-env operator-registry]# oc get pod -n openshift-operator-lifecycle-manager
NAME                                READY   STATUS    RESTARTS   AGE
catalog-operator-79b84f5f77-999br   1/1     Running   0          42m
olm-operator-5bddb4549f-2v6rf       1/1     Running   0          42m
packageserver-85b744db79-2mjtm      1/1     Running   0          42m
packageserver-85b744db79-w4bx4      1/1     Running   0          44m
[root@preserve-olm-env operator-registry]# oc exec catalog-operator-79b84f5f77-999br -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.16.1
git commit: f754da683a76e2f0f7fe0cd08b96f925c4a24cb2

[root@preserve-olm-env 1885398]# git clone git:awgreene/webhook-operator.git
Cloning into 'webhook-operator'...
remote: Enumerating objects: 55, done.
remote: Counting objects: 100% (55/55), done.
remote: Compressing objects: 100% (45/45), done.
remote: Total 249 (delta 15), reused 42 (delta 10), pack-reused 194
Receiving objects: 100% (249/249), 38.65 MiB | 44.36 MiB/s, done.
Resolving deltas: 100% (96/96), done.
[root@preserve-olm-env 1885398]# cd webhook-operator/

[root@preserve-olm-env webhook-operator]# cat olm/ocp/install/00_catsrc.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: CatalogSource
metadata:
  name: webhook-operator-catalog
  namespace: openshift-marketplace
spec:
  displayName: Webhook Operator Catalog
  image: quay.io/olmtest/webhook-operator-index:0.0.3
  sourceType: grpc

[root@preserve-olm-env webhook-operator]# kubectl apply -f olm/ocp/install/00_catsrc.yaml
catalogsource.operators.coreos.com/webhook-operator-catalog created

[root@preserve-olm-env webhook-operator]# cat olm/ocp/install/01_sub.yaml
apiVersion: operators.coreos.com/v1alpha1
kind: Subscription
metadata:
  name: webhook-operator-subscription
  namespace: openshift-operators
spec:
  channel: "alpha"
  installPlanApproval: Automatic
  name: webhook-operator
  source: webhook-operator-catalog
  sourceNamespace: openshift-marketplace
[root@preserve-olm-env webhook-operator]# kubectl apply -f olm/ocp/install/01_sub.yaml
subscription.operators.coreos.com/webhook-operator-subscription created
[root@preserve-olm-env webhook-operator]# oc get sub -n openshift-operators
NAME                            PACKAGE            SOURCE                     CHANNEL
webhook-operator-subscription   webhook-operator   webhook-operator-catalog   alpha
[root@preserve-olm-env webhook-operator]# oc get csv -n openshift-operators
NAME                      DISPLAY            VERSION   REPLACES   PHASE
webhook-operator.v0.0.1   Webhook Operator   0.0.1                Succeeded
[root@preserve-olm-env webhook-operator]# oc get pods -n openshift-operators
NAME                                       READY   STATUS    RESTARTS   AGE
webhook-operator-webhook-98657b46f-ghvbg   2/2     Running   0          33s

#edit csv to remove validating and mutating webhooks. Only left conversion webhook.
[root@preserve-olm-env webhook-operator]# oc edit csv webhook-operator.v0.0.1 -n openshift-operators
clusterserviceversion.operators.coreos.com/webhook-operator.v0.0.1 edited

[root@preserve-olm-env webhook-operator]# oc get pods -n openshift-operators
NAME                                       READY   STATUS    RESTARTS   AGE
webhook-operator-webhook-98657b46f-ghvbg   2/2     Running   0          2m21s
[root@preserve-olm-env webhook-operator]# oc delete pod webhook-operator-webhook-98657b46f-ghvbg -n openshift-operators
pod "webhook-operator-webhook-98657b46f-ghvbg" deleted
[root@preserve-olm-env webhook-operator]# oc get pods -n openshift-operators
NAME                                       READY   STATUS              RESTARTS   AGE
webhook-operator-webhook-98657b46f-55sbp   0/2     ContainerCreating   0          10s
[root@preserve-olm-env webhook-operator]# oc get pods -n openshift-operators
NAME                                       READY   STATUS    RESTARTS   AGE
webhook-operator-webhook-98657b46f-55sbp   2/2     Running   0          17s
[root@preserve-olm-env webhook-operator]# 
--

Comment 8 errata-xmlrpc 2020-11-30 16:45:28 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 (OpenShift Container Platform 4.6.6 bug fix 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/RHBA-2020:5115


Note You need to log in before you can comment on or make changes to this bug.