-
Notifications
You must be signed in to change notification settings - Fork 55
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
Plugin flattening #240
Plugin flattening #240
Conversation
Skipping CI for Draft Pull Request. |
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.
Amazing work. Seems you did it faster than I need to review )
left some minor comments and will continue to review
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 to work as expected.
We need to agree on the plan regards devfile's plugin registry, if we are going to support them or not (ones we're able to reference with ID, as we used to do).
if no - there is no a reason to keep it in the model.
Actually URI could work with the registry as well, it's just a question if we need some defaulting for the registry or not.
I agree -- my current understanding is that @sleshchenko WDYT about:
|
b7ea6a1
to
39cb7a8
Compare
I re-squashed and PR #237 and rebased onto it, which broke any commit refs, sorry for any confusion. |
39cb7a8
to
57a6335
Compare
Add a library function ResolveDevWorkspace, which is intended to manage flattening of DevWorkspaces with parents and plugins. An initial, basic implementation supports only flattening plugins defined via kubernetes reference. Contains a multitude of TODOs for next steps. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Temporarily use the flatten library in the main reconcile loop for DevWorkspaces; this should eventually be moved to a subcontroller. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Since the reconcile loop has to work on the flattened devworkspace contents while updating annotations on the original object, some care is required. To this end: * Make a copy of the original devworkspace from the cluster, which is the only object to be updated * Rework startup timing functionality to not involve directly modifying the devworkspace resource; instead use a map that we merge into the (cluster) workspace annotations only when needed. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
* Add samples/plugins directory containing DevWorkspaceTemplates defining plugins used in sample devfiles * Add Makefile rule install_plugin_templates which deploys above templates to devworkspace-plugins namespace * Add samples/with-k8s-ref directory containing DevWorkspace samples that reference plugins via DevWorkspaceTemplate Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Devfile API merge function panics if parent content is nil Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Work around panic when trying to use plugin overrides to override a devworkspace spec in devfile API. Ref: devfile/api#296 Signed-off-by: Angel Misevski <amisevsk@redhat.com>
* Add functionality for detecting reference cycles in plugins (e.g. plugin A references plugin B which references plugin A), avoiding the potential to lock the operator * Add basic functionality for supporting compatibility between plugins and editors, based on annotations applied to DevWorkspaceTemplates representing plugins; some work would be required for similar functionality for plugins specified by e.g. ID. This is done by building a tree of plugin information as we flatten plugin imports; each node in the tree stores the information about the plugin, a node representing the component that imported it, and a list of nodes representing plugins it imports. We can walk this tree to check e.g. plugin labels for all plugins included in the workspace (to check compatiblity) or to look for import loops (by following parent references). Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
This functionality is required for e.g. Theia to be able to create DevWorkspaceTemplates and import them into the current workspace. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
If a DevWorkspace specifies a plugin via Kubernetes reference and does not include a namespace, look in the DevWorkspace's namespace by default. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Configure the DevWorkspace controller as an owner of DevWorkspaceTemplates, in order to trigger reconciles when DevWorkspaceTemplates owned by DevWorkspaces are updated. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
57a6335
to
c2ae3ed
Compare
#237 is merged and this PR has been rebased onto the new master branch. |
Feature needs more time in the oven -- especially around how annotations/metadata is used, or whether this is something that should be implemented in the controller at all. Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Move remote-runtime-injector and vsx-installer to separate plugins that are imported by theia, rather than having a huge theia plugin definition Signed-off-by: Angel Misevski <amisevsk@redhat.com>
2ccc23f
to
e6cf53a
Compare
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@@ -199,6 +199,11 @@ endif | |||
mv config/base/config.properties.bak config/base/config.properties | |||
mv config/base/manager_image_patch.yaml.bak config/base/manager_image_patch.yaml | |||
|
|||
### install_plugin_templates: Deploy sample plugin templates to namespace devworkspace-plugins: | |||
install_plugin_templates: _print_vars |
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'm OK with it as temporary solution until Theia did not provide DWT for its plugins. But generally I'm not sure we should have a dedicated namespace for devworkspace-plugins, and to avoid security issues we should disable cross-namespace DTW usage at this point.
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.
Yeah, this is a development feature, since we need something to replace plugin registry until something else is implemented. this rule deploys sample plugins that are compatible with devfile samples.
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.
As for cross-namespace dwt use, I'm not sure I see the security risk necessarily. We end up running into an issue of cleanup if we're spreading dwts across the cluster, for statically created resources as we currently use.
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.
Approving it, since I'm OK with the proposed devworkspace startup flow.
Did not re-review or retest, but everything was fine I tried it.
The TODOs are listed in #249 as separate items and for me it's OK to handle them in further PRs.
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: amisevsk, sleshchenko 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 |
/test v5-devworkspaces-operator-e2e |
Reminding myself of why those TODOs are there (a couple of weeks later :)) -- I think it makes sense to do that as a separate PR. This PR implements "plugins via kubernetes reference" but WTO depends on "plugins via plugin ID". I don't expect it to be too complicated but it's probably cleaner than adding to this already-large PR. I'll retest everything on minikube and |
Tested current changes:
The default use case for web terminal on OpenShift fails because the web-terminal plugin tries to read |
Merging PR as-is to unblock other work -- it seems fairly stable with known issues. |
(Don't worry about line count, 1100 lines are from test cases and 400 are from new devworkspace samples)
What does this PR do?
Readds support for Plugins in DevWorkspaces by implementing basic plugin resolution and merging.
Commits:
NamespacedName
references, as described in the devfile API spec.samples/plugins
contains plugin definitions;samples/with-k8s-ref
contains devworkspaces that reference these plugins)In a couple of cases, I had to work around devfile/api issues: devfile/api#296 and devfile/api#295; these are referenced in the code with TODOs.
Hopefully commit messages are clear enough to explain the purpose of each change.
What issues does this PR fix or reference?
#249; also a followup to #237 and issue #185
Is it tested? How?
This PR adds a makefile rule
install_plugin_templates
, which deploys new DevWorkspaceTemplates to thedevworkspace-plugins
namespace (namespace is hardcoded so we can easily refer to them). After this is done, DevWorkspaces can be deployed with plugins included from thesamples/with-k8s-ref/
directory.TODO: