diff --git a/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml b/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml index 7ade5acae9..1d4af0f8a4 100644 --- a/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml +++ b/manifests/0000_50_olm_08-catalog-operator.deployment.ibm-cloud-managed.yaml @@ -78,6 +78,8 @@ spec: env: - name: RELEASE_VERSION value: "0.0.1-snapshot" + - name: RUNTIME_CONSTRAINTS + value: "/opt/olm/runtime_constraints.json" nodeSelector: kubernetes.io/os: linux tolerations: diff --git a/manifests/0000_50_olm_08-catalog-operator.deployment.yaml b/manifests/0000_50_olm_08-catalog-operator.deployment.yaml index 07557ef036..b966942891 100644 --- a/manifests/0000_50_olm_08-catalog-operator.deployment.yaml +++ b/manifests/0000_50_olm_08-catalog-operator.deployment.yaml @@ -79,6 +79,8 @@ spec: env: - name: RELEASE_VERSION value: "0.0.1-snapshot" + - name: RUNTIME_CONSTRAINTS + value: "/opt/olm/runtime_constraints.json" nodeSelector: kubernetes.io/os: linux node-role.kubernetes.io/master: "" diff --git a/operator-lifecycle-manager.Dockerfile b/operator-lifecycle-manager.Dockerfile index 56bb16c4cb..e99959fd92 100644 --- a/operator-lifecycle-manager.Dockerfile +++ b/operator-lifecycle-manager.Dockerfile @@ -27,6 +27,9 @@ COPY --from=builder /build/bin/package-server /bin/package-server COPY --from=builder /build/bin/cpb /bin/cpb COPY --from=builder /build/bin/psm /bin/psm +# Add runtime constraints +COPY --from=builder /build/runtime_constraints/runtime_constraints.json /opt/olm/runtime_constraints.json + # This image doesn't need to run as root user. USER 1001 diff --git a/runtime_constraints/README.md b/runtime_constraints/README.md new file mode 100644 index 0000000000..5381491aed --- /dev/null +++ b/runtime_constraints/README.md @@ -0,0 +1,11 @@ +# Cluster Runtime Constraints + +Cluster runtime constraints are base constraints that always get applied to the resolution process to avoid installing +packages that might be unsuitable for the cluster (consumes too many resources, wrong kubernetes/ocp version, etc.). +Currently, there's no first class way to do this. Until we design the canonical way to define +cluster runtime constraints, we are making availing a stopgap solution for IBM and OCP, we: + 1. Are adding a file to the downstream OLM image that includes the runtime constraints + 2. Have modified the upstream catalog operator to load the runtime constraints in to the resolver if a `RUNTIME_CONSTRAINTS` environment variable is defined + 3. Update the deployment manifests for the olm catalog operator deployment to add the `RUNTIME_CONSTRAINTS` environment variable + +The upstream PR enabling this behavior is [https://github.com/operator-framework/operator-lifecycle-manager/pull/2498](#2498). diff --git a/runtime_constraints/runtime_constraints.json b/runtime_constraints/runtime_constraints.json new file mode 100644 index 0000000000..acf3e68658 --- /dev/null +++ b/runtime_constraints/runtime_constraints.json @@ -0,0 +1,11 @@ +{ + "properties": [ + { + "type": "olm.package", + "value": { + "packageName": "etcd", + "version": "1.0.0" + } + } + ] +} \ No newline at end of file