Skip to content

Commit 134181b

Browse files
committed
Add flattened devfile samples for testing
Signed-off-by: Angel Misevski <[email protected]>
1 parent eef997f commit 134181b

File tree

6 files changed

+281
-61
lines changed

6 files changed

+281
-61
lines changed

samples/cloud-shell.yaml

Lines changed: 0 additions & 22 deletions
This file was deleted.

samples/flattened_theia-next.yaml

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
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 ###

samples/all-in-one-theia-nodejs.devworkspace.yaml renamed to samples/flattened_theia-nodejs.yaml

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ spec:
66
started: true
77
template:
88
projects:
9-
- name: project
9+
- name: web-nodejs-sample
1010
git:
1111
remotes:
1212
origin: "https://github.com/che-samples/web-nodejs-sample.git"
@@ -75,11 +75,11 @@ spec:
7575
- name: "theia-redir-3"
7676
exposure: public
7777
targetPort: 13133
78-
protocol: http
78+
protocol: http
7979

8080
- name: plugins
81-
volume: {}
82-
81+
volume: {}
82+
8383
- name: vsx-installer # Mainly reads the container objects and searches for those
8484
# with che-theia.eclipse.org/vscode-extensions attributes to get VSX urls
8585
# Those found in the dedicated containers components are with a sidecar,
@@ -91,8 +91,18 @@ spec:
9191
args:
9292
- /bin/sh
9393
- '-c'
94-
- >
95-
workspace=$(curl -fsS --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer $(cat /var/run/secrets/kubernetes.io/serviceaccount/token)" https://kubernetes.default.svc/apis/workspace.devfile.io/v1alpha2/namespaces/${CHE_WORKSPACE_NAMESPACE}/devworkspaces/${CHE_WORKSPACE_NAME}) && 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 dest=$(echo "$container" | sed 's;.*{"name":"THEIA_PLUGINS","value":"local-dir://\([^"][^"]*\)"}.*;\1;' - ) ; urls=$(echo "$container" | sed 's;.*"che-theia.eclipse.org/vscode-extensions":\[\([^]][^]]*\)\]}.*;\1;' - ) ; mkdir -p $dest; for url in $(echo $urls | sed 's/[",]/ /g' - ); do echo; echo downloading $urls to $dest; curl -L $url > $dest/$(basename $url); done; done
94+
- |
95+
KUBE_API_ENDPOINT="https://kubernetes.default.svc/apis/workspace.devfile.io/v1alpha2/namespaces/${CHE_WORKSPACE_NAMESPACE}/devworkspaces/${CHE_WORKSPACE_NAME}" &&\
96+
TOKEN=$(cat /var/run/secrets/kubernetes.io/serviceaccount/token) &&\
97+
WORKSPACE=$(curl -fsS --cacert /var/run/secrets/kubernetes.io/serviceaccount/ca.crt -H "Authorization: Bearer ${TOKEN}" $KUBE_API_ENDPOINT) &&\
98+
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 \
99+
dest=$(echo "$container" | sed 's;.*{"name":"THEIA_PLUGINS","value":"local-dir://\([^"][^"]*\)"}.*;\1;' - ) ;\
100+
urls=$(echo "$container" | sed 's;.*"che-theia.eclipse.org/vscode-extensions":\[\([^]][^]]*\)\]}.*;\1;' - ) ;\
101+
mkdir -p $dest ;\
102+
for url in $(echo $urls | sed 's/[",]/ /g' - ); do \
103+
echo; echo downloading $urls to $dest; curl -L $url > $dest/$(basename $url) ;\
104+
done \
105+
done \
96106
image: 'quay.io/samsahai/curl:latest'
97107
volumeMounts:
98108
- path: "/plugins"
@@ -143,7 +153,7 @@ spec:
143153
attributes:
144154
"app.kubernetes.io/part-of": che-theia.eclipse.org
145155
"app.kubernetes.io/component": vscode-plugin
146-
156+
147157
# Added by Che-theia at start when detecting, after cloning, that the extensions.json in the repo
148158
# contains the typescript vscode plugin.
149159
"che-theia.eclipse.org/vscode-extensions":
@@ -154,15 +164,15 @@ spec:
154164
memoryLimit: '512Mi'
155165
env:
156166
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
157-
value: /remote-endpoint/plugin-remote-endpoint
167+
value: /remote-endpoint/plugin-remote-endpoint
158168
- name: THEIA_PLUGINS
159169
value: local-dir:///plugins/sidecars/vscode-typescript
160170
volumeMounts:
161171
- path: "/remote-endpoint"
162172
name: remote-endpoint
163173
- name: plugins
164174
path: /plugins
165-
175+
166176
# plugin:
167177
# name: node-debug-plugin
168178
# id: ms-vscode/node-debug2/latest
@@ -171,19 +181,19 @@ spec:
171181
attributes:
172182
"app.kubernetes.io/part-of": che-theia.eclipse.org
173183
"app.kubernetes.io/component": vscode-plugin
174-
184+
175185
# Added by Che-theia at start when detecting, after cloning, that the extensions.json in the repo
176186
# contains the typescript vscode plugin.
177187
"che-theia.eclipse.org/vscode-extensions":
178188
- https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-node-debug/node-debug-1.41.1.vsix
179189
- https://download.jboss.org/jbosstools/vscode/3rdparty/vscode-node-debug2/node-debug2-1.42.3.vsix
180-
190+
181191
container:
182192
image: "quay.io/eclipse/che-sidecar-node:12-026416c"
183193
memoryLimit: '512Mi'
184194
env:
185195
- name: PLUGIN_REMOTE_ENDPOINT_EXECUTABLE
186-
value: /remote-endpoint/plugin-remote-endpoint
196+
value: /remote-endpoint/plugin-remote-endpoint
187197
- name: THEIA_PLUGINS
188198
value: local-dir:///plugins/sidecars/vscode-node-debug
189199
volumeMounts:
@@ -192,7 +202,7 @@ spec:
192202
- path: "/plugins"
193203
name: plugins
194204

195-
# User runtime container
205+
# User runtime container
196206
- name: nodejs
197207
container:
198208
image: quay.io/eclipse/che-nodejs10-ubi:nightly
@@ -253,7 +263,7 @@ spec:
253263
}
254264
]
255265
}
256-
266+
257267
events:
258268
preStart:
259269
- inject-theia-in-remote-sidecar
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
kind: DevWorkspace
2+
apiVersion: workspace.devfile.io/v1alpha2
3+
metadata:
4+
name: web-terminal-dev
5+
annotations:
6+
controller.devfile.io/restricted-access: "true"
7+
labels:
8+
# it's a label OpenShift console uses a flag to mark terminal's workspaces
9+
console.openshift.io/terminal: "true"
10+
spec:
11+
started: true
12+
routingClass: 'basic'
13+
template:
14+
components:
15+
# TODO: Remove once defaulting for web terminal is implemented.
16+
- name: dev
17+
container:
18+
image: quay.io/wto/web-terminal-tooling:latest
19+
mountSources: false
20+
memoryLimit: 256Mi
21+
args: ["tail", "-f", "/dev/null"]
22+
env:
23+
- value: '\[\e[34m\]>\[\e[m\]\[\e[33m\]>\[\e[m\]'
24+
name: PS1
25+
- name: web-terminal
26+
container:
27+
image: quay.io/eclipse/che-machine-exec:nightly
28+
mountSources: false
29+
command: ["/go/bin/che-machine-exec",
30+
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
31+
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
32+
"--pod-selector", "controller.devfile.io/workspace_id=$(CHE_WORKSPACE_ID)",
33+
"--use-bearer-token"]
34+
endpoints:
35+
- name: web-terminal
36+
targetPort: 4444
37+
attributes:
38+
protocol: http
39+
type: ide
40+
discoverable: "false"
41+
secure: "true"
42+
cookiesAuthEnabled: "true"
43+
env:
44+
- name: USE_BEARER_TOKEN
45+
value: "true"
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
kind: DevWorkspace
2+
apiVersion: workspace.devfile.io/v1alpha2
3+
metadata:
4+
name: web-terminal
5+
annotations:
6+
controller.devfile.io/restricted-access: "true"
7+
labels:
8+
# it's a label OpenShift console uses a flag to mark terminal's workspaces
9+
console.openshift.io/terminal: "true"
10+
spec:
11+
started: true
12+
routingClass: 'web-terminal'
13+
template:
14+
components:
15+
# TODO: Remove once defaulting for web terminal is implemented.
16+
- name: dev
17+
container:
18+
image: quay.io/wto/web-terminal-tooling:latest
19+
mountSources: false
20+
memoryLimit: 256Mi
21+
args: ["tail", "-f", "/dev/null"]
22+
env:
23+
- value: '\[\e[34m\]>\[\e[m\]\[\e[33m\]>\[\e[m\]'
24+
name: PS1
25+
- name: web-terminal
26+
container:
27+
image: quay.io/eclipse/che-machine-exec:nightly
28+
mountSources: false
29+
command: ["/go/bin/che-machine-exec",
30+
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
31+
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
32+
"--pod-selector", "controller.devfile.io/workspace_id=$(CHE_WORKSPACE_ID)",
33+
"--use-bearer-token",
34+
"--use-tls"]
35+
endpoints:
36+
- name: web-terminal
37+
targetPort: 4444
38+
attributes:
39+
protocol: http
40+
type: ide
41+
discoverable: "false"
42+
secure: "true"
43+
cookiesAuthEnabled: "true"
44+
env:
45+
- name: USE_BEARER_TOKEN
46+
value: "true"

0 commit comments

Comments
 (0)