-
Notifications
You must be signed in to change notification settings - Fork 545
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
OLM operator support for downstream plug-ins #2843
OLM operator support for downstream plug-ins #2843
Conversation
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: perdasilva The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
ea79ffa
to
0b015f8
Compare
9c2aaa4
to
881b8be
Compare
@@ -37,6 +37,26 @@ type operatorConfig struct { | |||
configClient configv1client.Interface | |||
} | |||
|
|||
func (o *operatorConfig) OperatorClient() operatorclient.ClientInterface { |
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.
These chances go in conjunction with the OperatorConfig client interface on the plug-in package. This way the plug-in can have access to some of the configuration information
@@ -61,6 +61,10 @@ var ( | |||
ErrAPIServiceOwnerConflict = errors.New("unable to adopt APIService") | |||
) | |||
|
|||
// this unexported operator plugin slice provides an entrypoint for | |||
// downstream to inject its own plugins to augment the controller behavior | |||
var operatorPlugInFactoryFuncs []plugins.OperatorPlugInFactoryFunc |
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.
Using factory functions instead of the instantiated plug-in objects themselves. This guarantees that each instance of the operator gets their own instance of the plug-ins
881b8be
to
5cbf02b
Compare
Signed-off-by: perdasilva <[email protected]>
5cbf02b
to
bca9d5d
Compare
/lgtm |
Signed-off-by: perdasilva [email protected]
Description of the change:
This PR introduces the concept of a plug-in for the OLM controller. Plugins can be injected downstream through the unexported
operatorPlugIns
package variable. Once the OLM controller is finished initializing, it will instantiate each of the plugins in turn.Motivation for the change:
We need to add some downstream only code for handling csvs in lights of the label sync'er. This code will act on csv additions (non-copied csvs) and add a label to the namespace the csv belongs to, if it's not already there.
Architectural changes:
Adds an unexported package variable that carries the references to the plug-ins and initializes.
Adds some accessor methods to the operatorConfig to make some configuration information available to the plug-in
Breaks up the Operator interface into three interfaces to reduce the level of access to operator methods by the plug-in
Testing remarks:
No functional changes are brought in by this PR. No testing required.
Reviewer Checklist
/doc
[FLAKE]
are truly flaky and have an issue