Description of problem: In csv, set olm.maxOpenShiftVersion to be 4.9 in metadata/properties.yaml, set olm.maxOpenShiftVersion to be 4.11 there will be two properties for olm.maxOpenShiftVersion: properties: ... - type: olm.maxOpenShiftVersion value: "4.11" - type: olm.maxOpenShiftVersion value: "4.9" And seems the value olm.maxOpenShiftVersion to be 4.9 in csv is also take effect. zhaoxia@xzha-mac 5.0.4 % oc get clusterversion NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version 4.10.0-0.nightly-2021-10-25-190146 True False 6h18m Cluster version is 4.10.0-0.nightly-2021-10-25-190146 zhaoxia@xzha-mac new % oc get co operator-lifecycle-manager -o=jsonpath="{.status.conditions[?(@.type==\"Upgradeable\")].status}" False% Version-Release number of selected component (if applicable): zhaoxia@xzha-mac 5.0.4 % oc get clusterversion NAME VERSION AVAILABLE PROGRESSING SINCE STATUS version 4.10.0-0.nightly-2021-10-25-190146 True False 6h18m Cluster version is 4.10.0-0.nightly-2021-10-25-190146 How reproducible: always Steps to Reproduce: 1. configure olm.maxOpenShiftVersion in csv and metadata/properties.yaml In csv, set olm.maxOpenShiftVersion to be 4.9 in metadata/properties.yaml, set olm.maxOpenShiftVersion to be 4.11 zhaoxia@xzha-mac 5.0.4 % grep olm.maxOpenShiftVersion manifests/cockroachdb.clusterserviceversion.yaml -B 2 metadata: annotations: olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.9"}]' zhaoxia@xzha-mac 5.0.4 % cat metadata/properties.yaml properties: - type: olm.maxOpenShiftVersion value: "4.11" 2.build bundle image, and add in to index image #opm alpha bundle build -d manifests -c alpha -p cockroachdb -t quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test -o=true #docker push quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test #opm index add -b quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test -t quay.io/xzhao/cockroachdb-index:jira-2130-test -c docker #docker push quay.io/xzhao/cockroachdb-index:jira-2130-test 3, validate this bundle zhaoxia@xzha-mac new % opm alpha bundle validate --tag quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test --image-builder docker INFO[0000] Create a temp directory at /var/folders/0v/h_vdggrj5xlglg9r709mj3v40000gn/T/bundle-256078135 container-tool=docker DEBU[0000] Pulling and unpacking container image container-tool=docker INFO[0000] running /usr/local/bin/docker pull quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test container-tool=docker INFO[0004] running docker create container-tool=docker DEBU[0004] [docker create quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test ] container-tool=docker INFO[0004] running docker cp container-tool=docker DEBU[0004] [docker cp 7da98880ed8e39b781c427cfe8f8271cbfe608bba4559ff3c4fbc2b40c5cb989:/. /var/folders/0v/h_vdggrj5xlglg9r709mj3v40000gn/T/bundle-256078135] container-tool=docker INFO[0004] running docker rm container-tool=docker DEBU[0004] [docker rm 7da98880ed8e39b781c427cfe8f8271cbfe608bba4559ff3c4fbc2b40c5cb989] container-tool=docker INFO[0005] Unpacked image layers, validating bundle image format & contents container-tool=docker DEBU[0005] Found manifests directory container-tool=docker DEBU[0005] Found metadata directory container-tool=docker DEBU[0005] Getting mediaType info from manifests directory container-tool=docker DEBU[0005] Found annotations file container-tool=docker DEBU[0005] Could not find optional dependencies file container-tool=docker DEBU[0005] Validating bundle contents container-tool=docker DEBU[0005] Validating "apiextensions.k8s.io/v1, Kind=CustomResourceDefinition" from file "charts.operatorhub.io_cockroachdbs.yaml" container-tool=docker DEBU[0005] Validating "/v1, Kind=Service" from file "cockroachdb-controller-manager-metrics-service_v1_service.yaml" container-tool=docker DEBU[0005] Validating "rbac.authorization.k8s.io/v1, Kind=ClusterRole" from file "cockroachdb-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml" container-tool=docker DEBU[0005] Validating "operators.coreos.com/v1alpha1, Kind=ClusterServiceVersion" from file "cockroachdb.clusterserviceversion.yaml" container-tool=docker INFO[0005] All validation tests have been completed successfully container-tool=docker 4, create catsrc and sub zhaoxia@xzha-mac new % cat catsrc.yaml apiVersion: operators.coreos.com/v1alpha1 kind: CatalogSource metadata: name: index-2130 namespace: openshift-marketplace spec: displayName: Test publisher: OLM-QE sourceType: grpc image: quay.io/xzhao/cockroachdb-index:jira-2130-test updateStrategy: registryPoll: interval: 10m zhaoxia@xzha-mac new % cat sub.yaml apiVersion: operators.coreos.com/v1alpha1 kind: Subscription metadata: name: test-operator-2130 namespace: test-2130 spec: channel: alpha installPlanApproval: Automatic name: cockroachdb source: index-2130 sourceNamespace: openshift-marketplace 5.check csv zhaoxia@xzha-mac new % oc get csv -o yaml apiVersion: v1 items: - apiVersion: operators.coreos.com/v1alpha1 kind: ClusterServiceVersion metadata: annotations: ... olm.operatorNamespace: test-2130 olm.properties: '[{"type": "olm.maxOpenShiftVersion", "value": "4.11"}]' olm.targetNamespaces: test-2130 operatorframework.io/properties: '{"properties":[{"type":"olm.maxOpenShiftVersion","value":"4.11"},{"type":"olm.package","value":{"packageName":"cockroachdb","version":"5.0.4"}},{"type":"olm.maxOpenShiftVersion","value":"4.9"},{"type":"olm.gvk","value":{"group":"charts.operatorhub.io","kind":"Cockroachdb","version":"v1alpha1"}}]}' operators.operatorframework.io/builder: operator-sdk-v1.3.0 operators.operatorframework.io/project_layout: helm.sdk.operatorframework.io/v1 repository: https://github.com/dmesser/cockroachdb-operator 6, check operator-lifecycle-manager Upgradeable status zhaoxia@xzha-mac new % oc get co operator-lifecycle-manager -o=jsonpath="{.status.conditions[?(@.type==\"Upgradeable\")].status}" False% Actual results: there are two value in olm.properties. Expected results: there is one value in olm.properties which is the value in metadata/properties.yaml. according https://github.com/operator-framework/enhancements/blob/master/enhancements/properties.md#explicit-bundle-properties If properties are defined, they take precedence over the values derived from the bundle contents. or "opm alpha bundle validate" "opm index add" "opm validate" report error. Additional info:
Hi @xzha , Would you mind linking a must-gather? This would assist with the triaging process. Thank you for your time, Tyler
Hi, @tyslaton Please check bellow must-gather. https://drive.google.com/file/d/1X2aCu5-QhWy84hoBkj-q1pLYQpuhq_R9/view?usp=sharing
Hi again @xzha
It looks like we are going to implement a warning on the API (https://github.com/operator-framework/api) which then feeds into the operator-sdk. This is the approach we decided is the past path forward as the operator-sdk has more of an adoption base. As a result, once our fix is implemented, a warning will be output whenever a user defines `olm.properties` to inform them that that proper way of defining properties is in a `properties.yaml` file instead. Any thoughts on this?
Hi, @tyslaton Thanks lot for your information, the solution looks good to me.
The fix for this has been brought into the operator-sdk with a recent merge: https://github.com/operator-framework/operator-sdk/pull/5570 That update brings an upgrade to the api dependency which brings in this PR: https://github.com/operator-framework/api/pull/217 Marking this as modified as a result.
verify: zhaoxia@xzha-mac operator-sdk % ./build/operator-sdk version operator-sdk version: "v1.18.0-14-g4ccfe84a", commit: "4ccfe84ae1389b3acd8f34360611d361a6471f67", kubernetes version: "v1.23", go version: "go1.17.6", GOOS: "darwin", GOARCH: "amd64" zhaoxia@xzha-mac operator-sdk % ./build/operator-sdk bundle validate quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test INFO[0000] Unpacking image layers INFO[0000] running /usr/local/bin/docker pull quay.io/xzhao/cockroachdb-operator:5.0.4-2130-test INFO[0004] running docker create INFO[0004] running docker cp INFO[0004] running docker rm WARN[0005] Warning: Value : found olm.properties annotation, please define these properties in metadata/properties.yaml instead INFO[0005] All validation tests have completed successfully zhaoxia@xzha-mac operator-sdk % LGTM, verified