-
Notifications
You must be signed in to change notification settings - Fork 562
[WIP] Add cluster runtime constraint handling #2498
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
[WIP] Add cluster runtime constraint handling #2498
Conversation
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: perdasilva The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
6a7747e
to
3eaa726
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking promising.
I have a few comments. Plus, there is a bundles.json file and not sure what is it for?
} | ||
|
||
// Parse yaml | ||
var propertiesFile = ®istry.PropertiesFile{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to decide if this property
or a dependency
so we can use either PropertiesFile
or DependenciesFile
. Honestly, it is just wording but it is a decision to be made for syntax sake.
|
||
func readRuntimeConstraintsYaml(yamlPath string) (*registry.PropertiesFile, error) { | ||
// Read file | ||
yamlFile, err := ioutil.ReadFile(yamlPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did you test how this file-reading code will work in real life? How is this file gonna be "injected" into the process?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've tested it manually. I still need to add unit tests for this. I'm thinking the way to side-load it should be we have an environment variable that points to the path of the constraints file. Downstream, the file will be baked in to the olm operator image and we'll update the deployment to include the env var. This way, if people want to turn it off, it's doable. I'm not sure how this strategy fits with support, etc. E.g. if they turn it off would that mean the customer is in an unmanaged state?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if they turn it off would that mean the customer is in an unmanaged state?
it does
) | ||
|
||
const ( | ||
maxRuntimeConstraints = 10 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reasonable restriction to avoid abusing. Make sure this number is known and noticed upon the completion of this work.
3eaa726
to
39c27e5
Compare
Thank you ^^ I've removed the bundles.json. That was a mistake. |
39c27e5
to
3109383
Compare
ec632fc
to
4ababe0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So this is very similar to an injection method we rejected a while back: https://github.com/operator-framework/operator-lifecycle-manager/pull/2360/files
OLM will needs to support cluster runtime contraints. We are currently working on a fully fledged solution but it won't be ready in time to unblock our users. This approach gives downstreams a way to side-load runtime constraints in the mean time.
Which users are blocked without a method to side load global constraints? If we're talking about OpenShift users and the MaxOpenShiftVersion property, then I'd like to avoid adding new upstream APIs for them to be immediately superseded. We can carry a patch downstream that injects such specific constraints. In fact, I have some prior art there: openshift/operator-framework-olm#194
@@ -20,19 +22,39 @@ import ( | |||
opregistry "github.com/operator-framework/operator-registry/pkg/registry" | |||
) | |||
|
|||
const ( | |||
runtimeConstraintsFilePath = "runtime_constraints.json" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems like something that could be part of the OLMConfig
CR instead of a file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this could be much nicer. I just don't know what it means for the longer term vision of deppy and olm, etc. If this is still the way we'll want to handle these types of constraints. My thinking right now is to keep the "under-the-covers" way of doing it (baking this file in the downstream operator images) because it's super easy to roll-back and it buys us time to be more deliberate about how we want to handle these constraints in a first-class way. @joelanford @kevinrizza wdyt?
log: logger, | ||
// #2: apply constraints in addInvariants | ||
runtimeConstraintsProvider: runtimeConstraintProvider, // uncomment when using option #2 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it might require more refactoring, but we probably want to inject these dependencies.
|
||
func readRuntimeConstraintsYaml(yamlPath string) (*registry.PropertiesFile, error) { | ||
// Read file | ||
yamlFile, err := ioutil.ReadFile(yamlPath) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if they turn it off would that mean the customer is in an unmanaged state?
it does
Yeah, the main targets at the moment are OpenShift and IBM. I don't think we will be targetting anything other than OCP version. But, personally, I don't think we are making too many throw away changes. I think being able to inject these constraints (somehow) and have them understood by the resolver already adds value to the upstream, even if we don't offer a nice interface (yet) to define those. It also puts it in the hand of the community to test, evaluate, use our way of side-loading, come up with their own, etc. So, I think I'd push back a bit on the idea of a downstream (code) patch atm. |
f19c3a2
to
67745af
Compare
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
Signed-off-by: Per G. da Silva <[email protected]>
67745af
to
8bf42c5
Compare
closing in favor of #2523 |
Signed-off-by: Per G. da Silva [email protected]
Description of the change:
This PR introduces a backdoor way adding cluster runtime constraints to the resolver. The mechanism will look for a yaml file containing
olm.constraint
s that will be parsed into thecache.Predicate
s and considered during the resolution.Current Resolution Integration Approach
I've come up with a couple of strategies:
prohibited
in theaddInvariants
method.Option 2. seems the most reasonable since 1. adds a bit of hidden behaviour to the
cache
and it mightn't always be clear what is being applied and when.Motivation for the change:
OLM will needs to support cluster runtime contraints. We are currently working on a fully fledged solution but it won't be ready in time to unblock our users. This approach gives downstreams a way to side-load runtime constraints in the mean time.
Reviewer Checklist
/doc