|
| 1 | +kind: DevWorkspace |
| 2 | +apiVersion: workspace.devfile.io/v1alpha2 |
| 3 | +metadata: |
| 4 | + name: theia |
| 5 | +spec: |
| 6 | + started: true |
| 7 | + template: |
| 8 | + projects: |
| 9 | + - name: web-nodejs-sample |
| 10 | + git: |
| 11 | + remotes: |
| 12 | + origin: "https://github.com/che-samples/web-nodejs-sample.git" |
| 13 | + components: |
| 14 | + ### BEGIN Contributions from machine-exec plugin ### |
| 15 | + - name: terminal |
| 16 | + attributes: |
| 17 | + "app.kubernetes.io/name": che-terminal.eclipse.org |
| 18 | + "app.kubernetes.io/part-of": che.eclipse.org |
| 19 | + "app.kubernetes.io/component": terminal |
| 20 | + container: |
| 21 | + image: "quay.io/eclipse/che-machine-exec:nightly" |
| 22 | + command: ['/go/bin/che-machine-exec'] |
| 23 | + args: |
| 24 | + - '--url' |
| 25 | + - '0.0.0.0:4444' |
| 26 | + - '--pod-selector' |
| 27 | + - controller.devfile.io/workspace_id=$(CHE_WORKSPACE_ID) |
| 28 | + endpoints: |
| 29 | + - name: "che-mach-exec" |
| 30 | + exposure: public |
| 31 | + targetPort: 4444 |
| 32 | + protocol: ws |
| 33 | + secure: true |
| 34 | + attributes: |
| 35 | + type: terminal |
| 36 | + cookiesAuthEnabled: "true" |
| 37 | + ### END Contributions from machine-exec plugin ### |
| 38 | + ### BEGIN Contributions from Theia plugin ### |
| 39 | + - name: plugins |
| 40 | + volume: {} |
| 41 | + - name: remote-endpoint |
| 42 | + volume: {} # TODO: Fix this once ephemeral volumes are supported |
| 43 | + - name: vsx-installer # Mainly reads the container objects and searches for those |
| 44 | + # with che-theia.eclipse.org/vscode-extensions attributes to get VSX urls |
| 45 | + # Those found in the dedicated containers components are with a sidecar, |
| 46 | + # Those found in the che-theia container are without a sidecar. |
| 47 | + attributes: |
| 48 | + "app.kubernetes.io/part-of": che-theia.eclipse.org |
| 49 | + "app.kubernetes.io/component": bootstrapper |
| 50 | + container: |
| 51 | + args: |
| 52 | + - /bin/sh |
| 53 | + - '-c' |
| 54 | + - | |
| 55 | + KUBE_API_ENDPOINT="https://kubernetes.default.svc/apis/workspace.devfile.io/v1alpha2/namespaces/${CHE_WORKSPACE_NAMESPACE}/devworkspaces/${CHE_WORKSPACE_NAME}" &&\ |
| 56 | + TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) &&\ |
| 57 | + WORKSPACE=$(curl -fsS --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer ${TOKEN}" $KUBE_API_ENDPOINT) &&\ |
| 58 | + for container in $(echo $WORKSPACE | sed -e 's;[[,]\({"attributes":{"app.kubernetes.io\);\n\1;g' | grep '"che-theia.eclipse.org/vscode-extensions":' | grep -e '^{"attributes".*'); do \ |
| 59 | + dest=$(echo "$container" | sed 's;.*{"name":"THEIA_PLUGINS","value":"local-dir://\([^"][^"]*\)"}.*;\1;' - ) ;\ |
| 60 | + urls=$(echo "$container" | sed 's;.*"che-theia.eclipse.org/vscode-extensions":\[\([^]][^]]*\)\]}.*;\1;' - ) ;\ |
| 61 | + mkdir -p $dest ;\ |
| 62 | + for url in $(echo $urls | sed 's/[",]/ /g' - ); do \ |
| 63 | + echo; echo downloading $urls to $dest; curl -L $url > $dest/$(basename $url) ;\ |
| 64 | + done \ |
| 65 | + done \ |
| 66 | + image: 'quay.io/samsahai/curl:latest' |
| 67 | + volumeMounts: |
| 68 | + - path: "/plugins" |
| 69 | + name: plugins |
| 70 | + - name: remote-runtime-injector |
| 71 | + attributes: |
| 72 | + "app.kubernetes.io/part-of": che-theia.eclipse.org |
| 73 | + "app.kubernetes.io/component": bootstrapper |
| 74 | + container: #### corresponds to `initContainer` definition in old meta.yaml. |
| 75 | + image: "quay.io/eclipse/che-theia-endpoint-runtime-binary:7.20.0" |
| 76 | + volumeMounts: |
| 77 | + - path: "/remote-endpoint" |
| 78 | + name: remote-endpoint |
| 79 | + env: |
| 80 | + - name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE |
| 81 | + value: /remote-endpoint/plugin-remote-endpoint |
| 82 | + - name: REMOTE_ENDPOINT_VOLUME_NAME |
| 83 | + value: remote-endpoint |
| 84 | + - name: theia-ide |
| 85 | + attributes: |
| 86 | + "app.kubernetes.io/name": che-theia.eclipse.org |
| 87 | + "app.kubernetes.io/part-of": che.eclipse.org |
| 88 | + "app.kubernetes.io/component": editor |
| 89 | + |
| 90 | + # Added by Che-theia at start when detecting, after cloning, that the extensions.json in the repo |
| 91 | + # contains the vscode-pull-request-github vscode plugin. |
| 92 | + "che-theia.eclipse.org/vscode-extensions": |
| 93 | + - https://github.com/microsoft/vscode-pull-request-github/releases/download/v0.8.0/vscode-pull-request-github-0.8.0.vsix |
| 94 | + container: |
| 95 | + image: "quay.io/eclipse/che-theia:next" |
| 96 | + env: |
| 97 | + - name: THEIA_PLUGINS |
| 98 | + value: local-dir:///plugins |
| 99 | + - name: HOSTED_PLUGIN_HOSTNAME |
| 100 | + value: 0.0.0.0 |
| 101 | + - name: HOSTED_PLUGIN_PORT |
| 102 | + value: "3130" |
| 103 | + - name: THEIA_HOST |
| 104 | + value: 0.0.0.0 |
| 105 | + volumeMounts: |
| 106 | + - path: "/plugins" |
| 107 | + name: plugins |
| 108 | + mountSources: true |
| 109 | + memoryLimit: "512M" |
| 110 | + endpoints: |
| 111 | + - name: "theia" |
| 112 | + exposure: public |
| 113 | + targetPort: 3100 |
| 114 | + secure: true |
| 115 | + protocol: http |
| 116 | + attributes: |
| 117 | + type: ide |
| 118 | + cookiesAuthEnabled: "true" |
| 119 | + - name: "webviews" |
| 120 | + exposure: public |
| 121 | + targetPort: 3100 |
| 122 | + protocol: http |
| 123 | + secure: true |
| 124 | + attributes: |
| 125 | + type: webview |
| 126 | + cookiesAuthEnabled: "true" |
| 127 | + unique: "true" |
| 128 | + - name: "theia-dev" |
| 129 | + exposure: public |
| 130 | + targetPort: 3130 |
| 131 | + protocol: http |
| 132 | + attributes: |
| 133 | + type: ide-dev |
| 134 | + - name: "theia-redir-1" |
| 135 | + exposure: public |
| 136 | + targetPort: 13131 |
| 137 | + protocol: http |
| 138 | + - name: "theia-redir-2" |
| 139 | + exposure: public |
| 140 | + targetPort: 13132 |
| 141 | + protocol: http |
| 142 | + - name: "theia-redir-3" |
| 143 | + exposure: public |
| 144 | + targetPort: 13133 |
| 145 | + protocol: http |
| 146 | + ### END Contributions from Theia plugin ### |
| 147 | + |
| 148 | + commands: |
| 149 | + - id: say hello |
| 150 | + exec: |
| 151 | + component: plugin |
| 152 | + commandLine: echo "Hello from $(pwd)" |
| 153 | + workingDir: ${PROJECTS_ROOT}/project/app |
| 154 | + ### BEGIN Contributions from Theia plugin ### |
| 155 | + # Commands coming from plugin editor |
| 156 | + - id: inject-theia-in-remote-sidecar |
| 157 | + apply: |
| 158 | + component: remote-runtime-injector |
| 159 | + - id: copy-vsx |
| 160 | + apply: |
| 161 | + component: vsx-installer |
| 162 | + events: |
| 163 | + preStart: |
| 164 | + - inject-theia-in-remote-sidecar |
| 165 | + - copy-vsx |
| 166 | + ### END Contributions from Theia plugin ### |
0 commit comments