Skip to content

Commit

Permalink
Add tests for implicit container contribution to parent component
Browse files Browse the repository at this point in the history
Signed-off-by: Andrew Obuchowicz <aobuchow@redhat.com>
  • Loading branch information
AObuchow committed Aug 10, 2023
1 parent 7efdd22 commit de1a2ac
Show file tree
Hide file tree
Showing 4 changed files with 788 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,191 @@
name: "Contributes to parent devworkspace when no child container components present"

input:
devworkspace:
parent:
uri: parent.yaml
components:
- name: che-code
plugin:
uri: che-code.yaml

devfileResources:
parent.yaml:
schemaVersion: 2.1.0
metadata:
name: parent
components:
- name: tools
container:
image: quay.io/devfile/universal-developer-image:latest
env:
- name: GOPATH
value: /projects:/home/user/go
- name: GOCACHE
value: /tmp/.cache
endpoints:
- name: 8080-tcp
targetPort: 8080
memoryLimit: 2Gi
mountSources: true
che-code.yaml:
schemaVersion: 2.1.0
metadata:
name: che-code
commands:
- id: init-container-command
apply:
component: che-code-injector
events:
preStart:
- init-container-command
components:
- name: che-code-runtime-description
attributes:
app.kubernetes.io/component: che-code-runtime
app.kubernetes.io/part-of: che-code.eclipse.org
controller.devfile.io/container-contribution: true
container:
image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
command:
- /checode/entrypoint-volume.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 1024Mi
memoryRequest: 256Mi
cpuLimit: 500m
cpuRequest: 30m
endpoints:
- name: che-code
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
targetPort: 3100
exposure: public
path: '?tkn=eclipse-che'
secure: false
protocol: https
- name: code-redirect-1
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13131
exposure: public
protocol: http
- name: code-redirect-2
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13132
exposure: public
protocol: http
- name: code-redirect-3
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13133
exposure: public
protocol: http
- name: checode
volume: {}
- name: che-code-injector
container:
image: quay.io/che-incubator/che-code:insiders
command:
- /entrypoint-init-container.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 128Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m

output:
devworkspace:
components:
- name: tools
attributes:
app.kubernetes.io/component: che-code-runtime
app.kubernetes.io/part-of: che-code.eclipse.org
controller.devfile.io/merged-contributions: "che-code"
controller.devfile.io/imported-by: "parent"
container:
image: quay.io/devfile/universal-developer-image:latest
command:
- /checode/entrypoint-volume.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 3Gi
env:
- name: GOPATH
value: /projects:/home/user/go
- name: GOCACHE
value: /tmp/.cache
endpoints:
- name: 8080-tcp
targetPort: 8080
- name: che-code
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
targetPort: 3100
exposure: public
path: '?tkn=eclipse-che'
secure: false
protocol: https
- name: code-redirect-1
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13131
exposure: public
protocol: http
- name: code-redirect-2
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13132
exposure: public
protocol: http
- name: code-redirect-3
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13133
exposure: public
protocol: http
mountSources: true
- name: checode
attributes:
controller.devfile.io/imported-by: che-code
volume: {}
- name: che-code-injector
attributes:
controller.devfile.io/imported-by: che-code
container:
image: quay.io/che-incubator/che-code:insiders
command:
- /entrypoint-init-container.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 128Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m
commands:
- id: init-container-command
attributes:
controller.devfile.io/imported-by: che-code
apply:
component: che-code-injector
events:
preStart:
- init-container-command
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@
name: "Prioritizes contributing to child components over parent component"

input:
devworkspace:
parent:
uri: parent.yaml
components:
- name: first-child-component
container:
image: quay.io/devfile/universal-developer-image:latest
memoryLimit: 2Gi
mountSources: true
- name: che-code
plugin:
uri: che-code.yaml

devfileResources:
parent.yaml:
schemaVersion: 2.1.0
metadata:
name: parent
components:
- name: tools
container:
image: quay.io/devfile/universal-developer-image:latest
env:
- name: GOPATH
value: /projects:/home/user/go
- name: GOCACHE
value: /tmp/.cache
endpoints:
- name: 8080-tcp
targetPort: 8080
memoryLimit: 2Gi
mountSources: true
che-code.yaml:
schemaVersion: 2.1.0
metadata:
name: che-code
commands:
- id: init-container-command
apply:
component: che-code-injector
events:
preStart:
- init-container-command
components:
- name: che-code-runtime-description
attributes:
app.kubernetes.io/component: che-code-runtime
app.kubernetes.io/part-of: che-code.eclipse.org
controller.devfile.io/container-contribution: true
container:
image: quay.io/devfile/universal-developer-image:ubi8-0e189d9
command:
- /checode/entrypoint-volume.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 1024Mi
memoryRequest: 256Mi
cpuLimit: 500m
cpuRequest: 30m
endpoints:
- name: che-code
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
targetPort: 3100
exposure: public
path: '?tkn=eclipse-che'
secure: false
protocol: https
- name: code-redirect-1
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13131
exposure: public
protocol: http
- name: code-redirect-2
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13132
exposure: public
protocol: http
- name: code-redirect-3
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13133
exposure: public
protocol: http
- name: checode
volume: {}
- name: che-code-injector
container:
image: quay.io/che-incubator/che-code:insiders
command:
- /entrypoint-init-container.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 128Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m

output:
devworkspace:
components:
- name: tools
attributes:
controller.devfile.io/imported-by: "parent"
container:
image: quay.io/devfile/universal-developer-image:latest
env:
- name: GOPATH
value: /projects:/home/user/go
- name: GOCACHE
value: /tmp/.cache
endpoints:
- name: 8080-tcp
targetPort: 8080
memoryLimit: 2Gi
mountSources: true
- name: first-child-component
attributes:
app.kubernetes.io/component: che-code-runtime
app.kubernetes.io/part-of: che-code.eclipse.org
controller.devfile.io/merged-contributions: "che-code"
container:
image: quay.io/devfile/universal-developer-image:latest
command:
- /checode/entrypoint-volume.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 3Gi
endpoints:
- name: che-code
attributes:
type: main
cookiesAuthEnabled: true
discoverable: false
urlRewriteSupported: true
targetPort: 3100
exposure: public
path: '?tkn=eclipse-che'
secure: false
protocol: https
- name: code-redirect-1
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13131
exposure: public
protocol: http
- name: code-redirect-2
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13132
exposure: public
protocol: http
- name: code-redirect-3
attributes:
discoverable: false
urlRewriteSupported: true
targetPort: 13133
exposure: public
protocol: http
mountSources: true
- name: checode
attributes:
controller.devfile.io/imported-by: che-code
volume: {}
- name: che-code-injector
attributes:
controller.devfile.io/imported-by: che-code
container:
image: quay.io/che-incubator/che-code:insiders
command:
- /entrypoint-init-container.sh
volumeMounts:
- name: checode
path: /checode
memoryLimit: 128Mi
memoryRequest: 32Mi
cpuLimit: 500m
cpuRequest: 30m
commands:
- id: init-container-command
attributes:
controller.devfile.io/imported-by: che-code
apply:
component: che-code-injector
events:
preStart:
- init-container-command
Loading

0 comments on commit de1a2ac

Please sign in to comment.