Bug 2035859 - the output of opm render doesn't contain olm.constraint which is defined in dependencies.yaml
Summary: the output of opm render doesn't contain olm.constraint which is defined in ...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: OLM
Version: 4.10
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.10.0
Assignee: Vu Dinh
QA Contact: xzha
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-12-28 06:16 UTC by xzha
Modified: 2022-03-10 16:36 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-03-10 16:36:35 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github openshift operator-framework-olm pull 246 0 None open Bug 2035859: chore: pull constraint-related changes from api, registry and olm 2022-01-25 02:23:02 UTC
Red Hat Product Errata RHSA-2022:0056 0 None None None 2022-03-10 16:36:48 UTC

Description xzha 2021-12-28 06:16:33 UTC
Description of problem:
the output of opm render doesn't contain  olm.constraint which is defined in dependencies.yaml 

Version-Release number of selected component (if applicable):
zhaoxia@xzha-mac operator-registry % opm version
Version: version.Version{OpmVersion:"v1.19.5-7-g384af6b9", GitCommit:"384af6b9", BuildDate:"2021-12-28T04:26:34Z", GoOs:"darwin", GoArch:"amd64"}


How reproducible:
always

Steps to Reproduce:
1. create bundle 
zhaoxia@xzha-mac 0.9.2 % cat metadata/dependencies.yaml 
dependencies:
- type: olm.constraint
  value:
    Message: 'require to have "olm.type3"'
    cel:
      rule: 'properties.exists(p, p.type == "olm.type3")'

zhaoxia@xzha-mac 0.9.2 % tree .

├── manifests
│   ├── etcdbackups.etcd.database.coreos.com.crd.yaml
│   ├── etcdclusters.etcd.database.coreos.com.crd.yaml
│   ├── etcdoperator.v0.9.2.clusterserviceversion.yaml
│   └── etcdrestores.etcd.database.coreos.com.crd.yaml
└── metadata
    ├── annotations.yaml
    └── dependencies.yaml

zhaoxia@xzha-mac 0.9.2 % opm alpha bundle build -c alpha -e alpha -d manifests -t quay.io/olmqe/etcd-bundle:v0.9.2-47335 -p etcd
zhaoxia@xzha-mac 0.9.2 % docker push quay.io/olmqe/etcd-bundle:v0.9.2-47335         

2. opm alpha bundle validate -t quay.io/olmqe/etcd-bundle:v0.9.2-47335
zhaoxia@xzha-mac 0.9.2 % opm alpha bundle validate -t quay.io/olmqe/etcd-bundle:v0.9.2-47335
INFO[0000] Create a temp directory at /var/folders/0v/h_vdggrj5xlglg9r709mj3v40000gn/T/bundle-335054672  container-tool=docker
DEBU[0000] Pulling and unpacking container image         container-tool=docker
INFO[0000] running /usr/local/bin/docker pull quay.io/olmqe/etcd-bundle:v0.9.2-47335  container-tool=docker
INFO[0005] running docker create                         container-tool=docker
DEBU[0005] [docker create quay.io/olmqe/etcd-bundle:v0.9.2-47335 ]  container-tool=docker
INFO[0005] running docker cp                             container-tool=docker
DEBU[0005] [docker cp 4de53ee7b73e50a6b430002d761ac71455c2d52b99c708acba69036036b5b765:/. /var/folders/0v/h_vdggrj5xlglg9r709mj3v40000gn/T/bundle-335054672]  container-tool=docker
INFO[0006] running docker rm                             container-tool=docker
DEBU[0006] [docker rm 4de53ee7b73e50a6b430002d761ac71455c2d52b99c708acba69036036b5b765]  container-tool=docker
INFO[0006] Unpacked image layers, validating bundle image format & contents  container-tool=docker
DEBU[0006] Found manifests directory                     container-tool=docker
DEBU[0006] Found metadata directory                      container-tool=docker
DEBU[0006] Getting mediaType info from manifests directory  container-tool=docker
DEBU[0006] Found annotations file                        container-tool=docker
DEBU[0006] Found dependencies file                       container-tool=docker
DEBU[0006] Validating bundle contents                    container-tool=docker
DEBU[0006] Validating "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition" from file "etcdbackups.etcd.database.coreos.com.crd.yaml"  container-tool=docker
DEBU[0006] Validating "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition" from file "etcdclusters.etcd.database.coreos.com.crd.yaml"  container-tool=docker
DEBU[0006] Validating "operators.coreos.com/v1alpha1, Kind=ClusterServiceVersion" from file "etcdoperator.v0.9.2.clusterserviceversion.yaml"  container-tool=docker
DEBU[0006] Validating "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition" from file "etcdrestores.etcd.database.coreos.com.crd.yaml"  container-tool=docker
INFO[0006] All validation tests have been completed successfully  container-tool=docker

3. opm render quay.io/olmqe/etcd-bundle:v0.9.2-47335 -o yaml

zhaoxia@xzha-mac 0.9.2 % opm render quay.io/olmqe/etcd-bundle:v0.9.2-47335 -o yaml
---
image: quay.io/olmqe/etcd-bundle:v0.9.2-47335
name: etcdoperator.v0.9.2
package: etcd
properties:
- type: olm.gvk
  value:
    group: etcd.database.coreos.com
    kind: EtcdBackup
    version: v1beta2
- type: olm.gvk
  value:
    group: etcd.database.coreos.com
    kind: EtcdCluster
    version: v1beta2
- type: olm.gvk
  value:
    group: etcd.database.coreos.com
    kind: EtcdRestore
    version: v1beta2
- type: olm.package
  value:
    packageName: etcd
    version: 0.9.2
- type: olm.bundle.object
  value:
    data: ...
- type: olm.bundle.object
  value:
    data: ...
- type: olm.bundle.object
  value:
    data: ...
- type: olm.bundle.object
  value:
    data: ...
relatedImages:
- image: quay.io/coreos/etcd-operator@sha256:c0301e4686c3ed4206e370b42de5a3bd2229b9fb4906cf85f3f30650424abec2
  name: ""
- image: quay.io/olmqe/etcd-bundle:v0.9.2-47335
  name: ""
schema: olm.bundle

Actual results:
the the properties of the output doesn't contain olm.constraint

Expected results:
the the properties of the output contains olm.constraint

Additional info:

This issue also happened when the metadata/dependencies.yaml is like bellow:

zhaoxia@xzha-mac 0.9.2-7 % cat metadata/dependencies.yaml 
dependencies:
- type: olm.constraint
  value:
    any:
      constraints:
      - message: Package prometheus is needed for...
        package:
          packageName: prometheus
          versionRange: '>=0.27.0'
      - gvk:
          group: camel.apache.org
          kind: Integration
          version: v1
        message: GVK Integration is needed for
    message: All are required for etcd because..

Comment 1 xzha 2022-01-25 05:20:48 UTC
verify:
zhaoxia@xzha-mac operator-framework-olm % opm version
Version: version.Version{OpmVersion:"c24f7d924", GitCommit:"c24f7d924c5d439cfc4a7af2a34033a375a8415a", BuildDate:"2022-01-25T03:20:44Z", GoOs:"darwin", GoArch:"amd64"}

zhaoxia@xzha-mac operator-framework-olm % opm render quay.io/olmqe/etcd-bundle:v0.9.2-47335 -o yaml| grep olm.constraint -A 4     
- type: olm.constraint
  value:
    Message: require to have "olm.type3"
    cel:
      rule: ""
--
- type: olm.constraint
  value:
    Message: require to have "olm.type3"
    cel:
      rule: properties.exists(p, p.type == "olm.type3"

LGTM, verified.

Comment 4 xzha 2022-01-29 01:31:04 UTC
zhaoxia@xzha-mac operator-framework-olm % opm version
Version: version.Version{OpmVersion:"5863540f4", GitCommit:"5863540f44addf07e564b2e7c833c8a5f85841e7", BuildDate:"2022-01-29T01:10:53Z", GoOs:"darwin", GoArch:"amd64"}

zhaoxia@xzha-mac operator-framework-olm % 
zhaoxia@xzha-mac operator-framework-olm % opm render quay.io/olmqe/etcd-bundle:v0.9.2-47335 -o yaml| grep olm.constraint -A 4     
- type: olm.constraint
  value:
    Message: require to have "olm.type3"
    cel:
      rule: ""
--
- type: olm.constraint
  value:
    Message: require to have "olm.type3"
    cel:
      rule: properties.exists(p, p.type == "olm.type3"
zhaoxia@xzha-mac operator-framework-olm % 

LGTM, verified

Comment 7 errata-xmlrpc 2022-03-10 16:36:35 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.10.3 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-2022:0056


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