Skip to content
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

Add support for plugins referenced by URI or in external registries #269

Merged
merged 7 commits into from
Feb 23, 2021

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Feb 17, 2021

What does this PR do?

Adds support for downloading plugins via URI, enabling support for components.plugin.uri and components.plugin.id when registryUrl is specified. Adds tests to cover new functions.

What issues does this PR fix or reference?

Closes #266

Is it tested? How?

The easiest way to test this PR is probably to deploy the plugin registry from this repo:

# use the deploy-registry.sh script in the repo, or
export NAMESPACE=devworkspace-plugins
kubectl apply -n ${NAMESPACE} -f \
  https://raw.githubusercontent.com/amisevsk/devfile-plugin-registry/2e8f9a211bf8c9e33149627defa4fc5dc137e2c5/deploy/deployment.yaml
kubectl apply -n ${NAMESPACE} -f \
  https://raw.githubusercontent.com/amisevsk/devfile-plugin-registry/master/deploy/service.yaml
# For minikube:
export ROUTING_SUFFIX="$(minikube ip).nip.io"
curl https://raw.githubusercontent.com/amisevsk/devfile-plugin-registry/master/deploy/k8s/ingress.yaml \
  | envsubst \
  | kc apply -n ${NAMESPACE} -f -
export REGISTRY_URL="$(kubectl get ingress -n devworkspace-plugins che-plugin-registry -o json | jq -r '.spec.rules[0].host')/v3"
# For OpenShift
kubectl apply -n ${NAMESPACE} -f \
  https://raw.githubusercontent.com/amisevsk/devfile-plugin-registry/master/deploy/os/route.yaml
export REGISTRY_URL="http://$(kubectl get route -n devworkspace-plugins che-plugin-registry -o json | jq -r '.spec.host')/v3"

Apply a devworkspace referring to this registry:

cat <<EOF | kubectl apply -f -
kind: DevWorkspace
apiVersion: workspace.devfile.io/v1alpha2
metadata:
  name: theia
spec:
  started: true
  template:
    projects:
      - name: project
        git:
          remotes:
            origin: "https://github.com/che-samples/web-nodejs-sample.git"
    components:
      - name: theia
        plugin:
          id: eclipse/che-theia/next
          registryUrl: ${REGISTRY_URL}
      - name: terminal
        plugin:
          id: eclipse/che-machine-exec-plugin/nightly/
          registryUrl: ${REGISTRY_URL}
EOF

@amisevsk amisevsk changed the title Plugin uris Add support for plugins referenced by URI or in external registries Feb 17, 2021
Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

Everything makes sense to me, the only problem I run into when testing is:

reconnecting-websocket-mjs.js:518 WebSocket connection to 'wss://workspace8ea81d13d3e24820.apps-crc.testing/theia/services' failed: Error during WebSocket handshake: Unexpected response code: 404
(anonymous) @ reconnecting-websocket-mjs.js:518

so I'm not actually able to get into theia and test that everything is working correctly, the loader just keeps spinning

plugin *devworkspace.PluginComponent,
tools ResolverTools) (resolvedPlugin *devworkspace.DevWorkspaceTemplateSpec, pluginLabels map[string]string, err error) {

if plugin.Uri == "" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can this piece be hit? It looks like on line ~135 ish you have case plugin.Uri != ""

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

You're right, it can't -- I suppose it's moreso paranoia on my part from constantly having to check component.Plugin != nil 😄

I'll remove the check (this also increases our test coverage 😉 !)

)

const (
SupportedDevfileSchemaVersion = "2.0.0" // TODO what should this actually be at this point?
Copy link
Contributor

Choose a reason for hiding this comment

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

// TODO what should this actually be at this point?

I'd like to know the answer on that as well, I've just been using 2.0.0 on the dashboard side 😆

Copy link
Member

Choose a reason for hiding this comment

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

2.0.0 don't support setting cpuLimits, while 2.1.0 supports )

Probably we need support all and convert to the latest.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Realistically, it should be something like 2\..*\..*, assuming there's no backwards-incompatible changes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Replaced this with a basic ^2\..* regexp.

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

I followed the instructions for OpenShift and my workspace is RUNNING but I'm not able to access Che Theia due 404 -> Cannot GET /theia/
I have RHPDS cluster, but this issue is related more to Che Theia or single host per workspace, which I implemented and merged long time ago. So, I don't see how it's related to the current PR.

The changes LGTM, my testing RHPDS as almost successful, plugins are fetched and workspace pod is correctly created

Get(location string) (*http.Response, error)
}

func FetchDevWorkspaceTemplate(location string, httpClient HTTPGetter) (*dw.DevWorkspaceTemplateSpec, map[string]string, error) {
Copy link
Member

@sleshchenko sleshchenko Feb 18, 2021

Choose a reason for hiding this comment

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

this method does not have doc and even return params are not named. At least it's not clear what map is supposed to contain.
Consider fixing one of them or both

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed any handling of plugin metadata until we decide a plan for how to do it.

)

const (
SupportedDevfileSchemaVersion = "2.0.0" // TODO what should this actually be at this point?
Copy link
Member

Choose a reason for hiding this comment

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

2.0.0 don't support setting cpuLimits, while 2.1.0 supports )

Probably we need support all and convert to the latest.

@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, JPinkney, 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:
  • OWNERS [JPinkney,amisevsk,sleshchenko]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@amisevsk
Copy link
Collaborator Author

/test v5-devworkspaces-operator-e2e

1 similar comment
@amisevsk
Copy link
Collaborator Author

/test v5-devworkspaces-operator-e2e

Avoid processing plugin metadata as there's still not defined way to
translate metadata from a devfile into a DevWorkspace[Template]

Signed-off-by: Angel Misevski <[email protected]>
@amisevsk
Copy link
Collaborator Author

/test v5-devworkspaces-operator-e2e

Had to rebase over #270 and update imports to include v2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement support for devfile plugins specified by URI
4 participants