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

Enable referencing plugin components by ID (internal-registry only) #263

Merged
merged 9 commits into from
Feb 9, 2021
1 change: 1 addition & 0 deletions build/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ FROM registry.access.redhat.com/ubi8-minimal:8.2-349
WORKDIR /
COPY --from=builder /devworkspace-operator/_output/bin/devworkspace-controller /usr/local/bin/devworkspace-controller
COPY --from=builder /devworkspace-operator/_output/bin/webhook-server /usr/local/bin/webhook-server
COPY --from=builder /devworkspace-operator/internal-registry internal-registry

ENV USER_UID=1001 \
USER_NAME=devworkspace-controller
Expand Down
1 change: 1 addition & 0 deletions build/rhel.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ FROM registry.access.redhat.com/ubi8-minimal:8.2-349
WORKDIR /
COPY --from=builder /devworkspace-operator/_output/bin/devworkspace-controller /usr/local/bin/devworkspace-controller
COPY --from=builder /devworkspace-operator/_output/bin/webhook-server /usr/local/bin/webhook-server
COPY --from=builder /devworkspace-operator/internal-registry internal-registry

USER nonroot:nonroot

Expand Down
4 changes: 3 additions & 1 deletion controllers/workspace/devworkspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"strings"
"time"

registry "github.com/devfile/devworkspace-operator/pkg/library/flatten/internal_registry"

"github.com/devfile/devworkspace-operator/pkg/library/flatten"

containerlib "github.com/devfile/devworkspace-operator/pkg/library/container"
Expand Down Expand Up @@ -175,11 +177,11 @@ func (r *DevWorkspaceReconciler) Reconcile(req ctrl.Request) (reconcileResult ct

timing.SetTime(timingInfo, timing.ComponentsCreated)
// TODO#185 : Temporarily do devfile flattening in main reconcile loop; this should be moved to a subcontroller.
// TODO#185 : Implement defaulting container component for Web Terminals for compatibility
flattenHelpers := flatten.ResolverTools{
InstanceNamespace: workspace.Namespace,
Context: ctx,
K8sClient: r.Client,
InternalRegistry: &registry.InternalRegistryImpl{},
}
flattenedWorkspace, err := flatten.ResolveDevWorkspace(workspace.Spec.Template, flattenHelpers)
if err != nil {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
kind: DevWorkspaceTemplate
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: cloud-shell
spec:
components:
- name: web-terminal
container:
image: "${RELATED_IMAGE_plugin_eclipse_cloud_shell_nightly}"
mountSources: false
command: ["/go/bin/che-machine-exec",
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
"--pod-selector", "controller.devfile.io/workspace_id=$(DEVWORKSPACE_ID)",
"--use-bearer-token",
"--static", "/cloud-shell"]
endpoints:
- name: cloud-shell
exposure: public
targetPort: 4444
protocol: http
secure: true
path: /static/
attributes:
type: ide
37 changes: 0 additions & 37 deletions internal-registry/eclipse/cloud-shell/nightly/meta.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
kind: DevWorkspaceTemplate
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: web-terminal-dev
spec:
components:
- name: web-terminal
container:
image: "${RELATED_IMAGE_plugin_redhat_developer_web_terminal_dev_4_5_0}"
command: ["/go/bin/che-machine-exec",
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
"--pod-selector", "controller.devfile.io/workspace_id=$(DEVWORKSPACE_ID)",
"--use-bearer-token"]
endpoints:
- name: web-terminal
targetPort: 4444
secure: true
exposure: public
protocol: http
attributes:
type: ide
mountSources: false
env:
- name: USE_BEARER_TOKEN
value: "true"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
kind: DevWorkspaceTemplate
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: web-terminal-dev
spec:
components:
- name: web-terminal
container:
image: "${RELATED_IMAGE_plugin_redhat_developer_web_terminal_dev_nightly}"
command: ["/go/bin/che-machine-exec",
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
"--pod-selector", "controller.devfile.io/workspace_id=$(DEVWORKSPACE_ID)",
"--use-bearer-token"]
endpoints:
- name: web-terminal
targetPort: 4444
secure: true
exposure: public
protocol: http
attributes:
type: ide
mountSources: false
env:
- name: USE_BEARER_TOKEN
value: "true"

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
kind: DevWorkspaceTemplate
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: web-terminal
spec:
components:
- name: web-terminal
container:
image: "${RELATED_IMAGE_plugin_redhat_developer_web_terminal_4_5_0}"
command: ["/go/bin/che-machine-exec",
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
"--pod-selector", "controller.devfile.io/workspace_id=$(DEVWORKSPACE_ID)",
"--use-bearer-token",
"--use-tls"]
endpoints:
- name: web-terminal
targetPort: 4444
secure: true
exposure: internal
protocol: http
attributes:
type: ide
mountSources: false
env:
- name: USE_BEARER_TOKEN
value: "true"
37 changes: 0 additions & 37 deletions internal-registry/redhat-developer/web-terminal/4.5.0/meta.yaml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
kind: DevWorkspaceTemplate
apiVersion: workspace.devfile.io/v1alpha2
metadata:
name: web-terminal
spec:
components:
- name: web-terminal
container:
image: "${RELATED_IMAGE_plugin_redhat_developer_web_terminal_nightly}"
command: ["/go/bin/che-machine-exec",
"--authenticated-user-id", "$(DEVWORKSPACE_CREATOR)",
"--idle-timeout", "$(DEVWORKSPACE_IDLE_TIMEOUT)",
"--pod-selector", "controller.devfile.io/workspace_id=$(DEVWORKSPACE_ID)",
"--use-bearer-token",
"--use-tls"]
endpoints:
- name: web-terminal
targetPort: 4444
secure: true
exposure: internal
protocol: http
attributes:
type: ide
mountSources: false
env:
- name: USE_BEARER_TOKEN
value: "true"
37 changes: 0 additions & 37 deletions internal-registry/redhat-developer/web-terminal/nightly/meta.yaml

This file was deleted.

Loading