Bug 1838705

Summary: Wrong webhook port when using WebhookDescription
Product: OpenShift Container Platform Reporter: Yuval Turgeman <yturgema>
Component: OLMAssignee: Alexander Greene <agreene>
OLM sub component: OLM QA Contact: yhui
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: unspecified CC: agreene, stirabos
Version: 4.5   
Target Milestone: ---   
Target Release: 4.5.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Cause: OLM did not wire the container port of a webhook defined in a CSV to the Validating or Mutating Webhook Configuration created on cluster. The Webhook Configurations created on cluster would always be created with port 443. Consequence: Only webhooks that listened on port 443 would work. Fix: Wire the port defined for the Webhook in the CSV to the Webhook Configuration. Result: OLM now creates the Webhook Configuration with the correct port.
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-07-13 17:40:55 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 Yuval Turgeman 2020-05-21 15:54:55 UTC
Description of problem:
When specifying ContainerPort in a WebhookDescription, the generated webhook will not point to specified port.  Instead, the ValidatingWebhookConfiguration will always point to port 443.

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

How reproducible:
Always


Steps to Reproduce:
1. Deploy minikube with OLM from release-4.5
2. Define a webhookdefinition in a CSV with containerPort 5555
3. View the resulting ValidatingWebhookConfiguration

Actual results:
The ValidatingWebhookConfiguration's port will remain 443

Expected results:
The ValidatingWebhookConfiguration's port will remain 5555

Comment 4 yhui 2020-05-25 03:40:03 UTC
[root@preserve-olm-env ~]# oc get clusterversion
NAME      VERSION                             AVAILABLE   PROGRESSING   SINCE   STATUS
version   4.5.0-0.nightly-2020-05-24-223848   True        False         73m     Cluster version is 4.5.0-0.nightly-2020-05-24-223848
[root@preserve-olm-env 1838705]# oc exec catalog-operator-bdd5d58c9-qfg2x -n openshift-operator-lifecycle-manager -- olm --version
OLM version: 0.15.1
git commit: 1849f658a5c703a1c15bf4467df7eb928d321b18


Steps to test:
1. Install cluster with OLM.

2. Define a webhookdefinition in a CSV with containerPort 5555.
[root@preserve-olm-env 1838705]# cat csv.yaml
```
spec:
  apiservicedefinitions: {}
  webhookdefinitions:
  - generateName: object.auditor.com
    type: ValidatingAdmissionWebhook
    deploymentName: "object-auditor-webhook-deployment"
    containerPort: 5555
```

3. Create operatorgroup and csv.
[root@preserve-olm-env 1838705]# oc apply -f og.yaml 
operatorgroup.operators.coreos.com/hui-og created
[root@preserve-olm-env 1838705]# oc apply -f csv.yaml 
clusterserviceversion.operators.coreos.com/webhook.v1.0.0 created
[root@preserve-olm-env 1838705]# oc get og
NAME     AGE
hui-og   38s
[root@preserve-olm-env 1838705]# oc get csv
NAME             DISPLAY          VERSION   REPLACES   PHASE
webhook.v1.0.0   Simple Webhook   1.0.0                Succeeded

4. View the resulting ValidatingWebhookConfiguration
[root@preserve-olm-env 1838705]# oc get validatingwebhookconfiguration
NAME                       WEBHOOKS   AGE
autoscaling.openshift.io   2          88m
multus.openshift.io        1          95m
object.auditor.com-9m55w   1          82s
[root@preserve-olm-env 1838705]# oc get validatingwebhookconfiguration object.auditor.com-9m55w -o yaml |grep port
      port: 5555
The ValidatingWebhookConfiguration's port becomes 5555.

5. Edit the csv to change the containerPort from 5555 to 5556.
[root@preserve-olm-env 1838705]# oc edit csv webhook.v1.0.0

6. View the resulting ValidatingWebhookConfiguration
[root@preserve-olm-env 1838705]# oc get validatingwebhookconfiguration object.auditor.com-9m55w -o yaml |grep port
      port: 5556
The ValidatingWebhookConfiguration's port becomes 5556.

The result is what we expected. Verify the bug.

Comment 5 errata-xmlrpc 2020-07-13 17:40:55 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, 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:2409