vmware-tanzu-labs / educates-training-platform

A platform for hosting interactive workshop environments in Kubernetes, or on top of a local container runtime.
https://docs.educates.dev
Apache License 2.0
63 stars 15 forks source link

Can't override workshop/terminal layout from inside of session. #370

Closed GrahamDumpleton closed 1 month ago

GrahamDumpleton commented 1 month ago

Describe the bug

The workshop definition is injected into the workshop session container and is used to control certain aspects of how the workshop session dashboard is rendered. This includes how many terminal panes, dashboards tabs enabled, ingress proxy definitions etc.

spec:
  title: "Workshop"
  description: "Workshop."
  session:
    applications:
      terminal:
        enabled: true
        layout: split
  ingresses:
  - name: application
    port: 8080

In the past, some information such as workshop and terminal layout was passed to the container via environment variables. To support backward compatibility code such as the following is used.

WORKSHOP_LAYOUT=${WORKSHOP_LAYOUT=`workshop-definition -r '(.spec.session.applications.workshop.layout // "default")'`}
export WORKSHOP_LAYOUT

TERMINAL_LAYOUT=${TERMINAL_LAYOUT=`workshop-definition -r '(.spec.session.applications.terminal.layout // "default")'`}
export TERMINAL_LAYOUT

Even when the variable TERMINAL_LAYOUT is set to an empty string, this code is not falling back to using the value from the injected workshop definition file, thus preventing override of these layout settings inside of the container by modifying the workshop definition before the dashboard is started.

Should drop passing of these environment variables from the operator via the deployment and change code in workshop image (start-gateway script) to:

WORKSHOP_LAYOUT=$(workshop-definition -r '(.spec.session.applications.workshop.layout // "default")')
export WORKSHOP_LAYOUT

TERMINAL_LAYOUT=$(workshop-definition -r '(.spec.session.applications.terminal.layout // "default")')
export TERMINAL_LAYOUT

Additional information

No response

GrahamDumpleton commented 1 month ago

Another environment variable to check is CONSOLE_VENDOR, although technically this in the future wouldn't be able to be overridden on a per session basis as the intent is to deploy the console in a side car container rather than inside of the container. See https://github.com/vmware-tanzu-labs/educates-training-platform/issues/292

GrahamDumpleton commented 1 month ago

Need to also review all the ENABLE_??? environment variables and whether they are working as intended.

GrahamDumpleton commented 1 month ago

And obsolete DOWNLOAD_URL environment variable.