Skip to content

[WIP] Add cluster runtime constraints handling #220

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions manifests/0000_50_olm_08-catalog-operator.deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: ""
Expand Down
3 changes: 3 additions & 0 deletions operator-lifecycle-manager.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
11 changes: 11 additions & 0 deletions runtime_constraints/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Cluster Runtime Constraints
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this belong in docs.go? i.e. looks like something we want in the go docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please be more specific for me: do you mean there's a docs place in this repo? do you mean upstream? do you mean docstrings in the code?

My intent here is to add developer documentation - just so people get the context of why that file exists there. Once we have the right way of doing things, then all of this should go away.

It is still my intention to add user facing docs though - but I was thinking of doing that in the upstream

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


Cluster runtime constraints are base constraints that always get applied to the resolution process to avoid installing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems more apt to call it something like "global" or "static" than "cluster runtime", since this could be conflated with the "virtual bundle" concept mapped out in some of the EPs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

damn - I see a lot of refactoring in my future now hahaha

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).
11 changes: 11 additions & 0 deletions runtime_constraints/runtime_constraints.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"properties": [
{
"type": "olm.package",
"value": {
"packageName": "etcd",
"version": "1.0.0"
}
}
]
}