-
Notifications
You must be signed in to change notification settings - Fork 188
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
clean up operator initialization code #2901
Conversation
4d8fa77
to
256ca84
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.
LGTM. Thanks for handling it.
gadgettracermgr should also expose those params exposed by the gadget-service, this is however currently not handled in this PR (but maybe should also be added; using env variables on deployment maybe?)
I think it can be handled once we have #2831 (cc @mqasimsarfraz)
I noticed that the order of the commits breaks the compilation for some of them, can it be fixed?
@@ -89,6 +93,12 @@ func NewRunCommand(rootCmd *cobra.Command, runtime runtime.Runtime, hiddenColumn | |||
|
|||
ops := make([]operators.DataOperator, 0) | |||
for _, op := range operators.GetDataOperators() { |
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.
Don't we have global parameters for layer operators? I suppose we'll need to add them later on.
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.
Not yet, but yeah, we should add them sooner or later.
3c9f4e7
to
87eb57a
Compare
This change collects available operators when starting the service. Global operator params can be retrieved through `GetOperatorMap()`. Signed-off-by: Michael Friese <mfriese@microsoft.com>
This allows setting the eventBufferLength after creating the service. Will be used in upcoming commits. Signed-off-by: Michael Friese <mfriese@microsoft.com>
Signed-off-by: Michael Friese <mfriese@microsoft.com>
…mage-based gadgets Signed-off-by: Michael Friese <mfriese@microsoft.com>
Operator initialization should be handled by the caller that is also creating the gadget context, not the gadget context itself. This removes the old code and relies on initialization taking place somewhere else. Signed-off-by: Michael Friese <mfriese@microsoft.com>
87eb57a
to
6e250d5
Compare
Thanks for the review! |
Previously, for image-based gadgets, operators would lazily be initialized by the gadget context. That made it difficult to forward the actual global configuration of operators. Since we didn't really use those in the past, it was not a big issue.
However, now that we're for example using image verification that can be enabled/disabled using parameters, we need to clean this up. Currently, the client decides whether image validation is done by sending the appropriate flag to the server. This is however insecure, as the client shouldn't have authority over that decision. We may later on allow (using another param/setting that can be enabled on the server) clients to override certain behavior, but in general the server should decide about the security features.
This PR moves the initialization to all our entry points for image-based gadgets and exports the parameters to be set there, if applicable.
This means:
Fixes #2891