From 369060c8569cf2963b048e09fb2e9ad40fc2b152 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Fri, 18 Aug 2023 14:39:31 +1000 Subject: [PATCH 1/4] The host field of an ingress shouldn't be required and instead defaults to localhost. --- .../bundle/config/11-session-manager/01-crds-workshop.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/carvel-packages/training-platform/bundle/config/11-session-manager/01-crds-workshop.yaml b/carvel-packages/training-platform/bundle/config/11-session-manager/01-crds-workshop.yaml index 156a091b..6b98c43c 100644 --- a/carvel-packages/training-platform/bundle/config/11-session-manager/01-crds-workshop.yaml +++ b/carvel-packages/training-platform/bundle/config/11-session-manager/01-crds-workshop.yaml @@ -1034,7 +1034,6 @@ spec: type: object required: - name - - host properties: name: type: string From 85818d7230d40fe91fac7e12fcf1591631d1bd65 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Fri, 18 Aug 2023 14:40:05 +1000 Subject: [PATCH 2/4] Set a default for workshop directory as environment variable not defined when workshop disabled. --- .../base-environment/opt/gateway/src/backend/modules/config.ts | 2 +- .../base-environment/opt/renderer/src/backend/modules/config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workshop-images/base-environment/opt/gateway/src/backend/modules/config.ts b/workshop-images/base-environment/opt/gateway/src/backend/modules/config.ts index b6cfe647..5e8a3de0 100644 --- a/workshop-images/base-environment/opt/gateway/src/backend/modules/config.ts +++ b/workshop-images/base-environment/opt/gateway/src/backend/modules/config.ts @@ -55,7 +55,7 @@ const WORKSHOP_PORT = process.env.WORKSHOP_PORT const WORKSHOP_RENDERER = process.env.WORKSHOP_RENDERER const LOCAL_RENDERER_TYPE = process.env.LOCAL_RENDERER_TYPE -const WORKSHOP_DIR = process.env.WORKSHOP_DIR +const WORKSHOP_DIR = process.env.WORKSHOP_DIR || "/opt/workshop" const SLIDES_DIR = process.env.SLIDES_DIR const FILES_DIR = process.env.FILES_DIR const UPLOADS_DIR = process.env.UPLOADS_DIR diff --git a/workshop-images/base-environment/opt/renderer/src/backend/modules/config.ts b/workshop-images/base-environment/opt/renderer/src/backend/modules/config.ts index 27a88fbb..6dab5555 100644 --- a/workshop-images/base-environment/opt/renderer/src/backend/modules/config.ts +++ b/workshop-images/base-environment/opt/renderer/src/backend/modules/config.ts @@ -184,7 +184,7 @@ for (let key in process.env) let workshop_file = process.env.WORKSHOP_FILE || "workshop.yaml" -let workshop_dir = process.env.WORKSHOP_DIR +let workshop_dir = process.env.WORKSHOP_DIR || "/opt/workshop" if (workshop_dir && fs.existsSync(path.join(workshop_dir, "content"))) { config.workshop_dir = workshop_dir From bcedf3dbfd6a6ef05c0743e689e9582eae25ab47 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Fri, 18 Aug 2023 17:38:58 +1000 Subject: [PATCH 3/4] Always set workshop environment variables even if not enabled. --- .../base-environment/opt/eduk8s/etc/profile.d/02-workshop.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/workshop-images/base-environment/opt/eduk8s/etc/profile.d/02-workshop.sh b/workshop-images/base-environment/opt/eduk8s/etc/profile.d/02-workshop.sh index e25afe1d..b70f801f 100644 --- a/workshop-images/base-environment/opt/eduk8s/etc/profile.d/02-workshop.sh +++ b/workshop-images/base-environment/opt/eduk8s/etc/profile.d/02-workshop.sh @@ -4,10 +4,6 @@ # should be forced to be run earlier so WORKSHOP_DIR environment variable is # visible to slides configuration. -if [ x"$ENABLE_WORKSHOP" != x"true" ]; then - return -fi - WORKSHOP_PORT=10082 export WORKSHOP_PORT From 3c4cad436e88da2313e91877c8137673c8f19cba Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Fri, 18 Aug 2023 17:39:18 +1000 Subject: [PATCH 4/4] Don't generate workshop instructions using Hugo if workshop instructions not enabled. --- .../base-environment/opt/eduk8s/bin/rebuild-content | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/workshop-images/base-environment/opt/eduk8s/bin/rebuild-content b/workshop-images/base-environment/opt/eduk8s/bin/rebuild-content index 4fc72b95..915505a1 100755 --- a/workshop-images/base-environment/opt/eduk8s/bin/rebuild-content +++ b/workshop-images/base-environment/opt/eduk8s/bin/rebuild-content @@ -38,6 +38,12 @@ fi ytt -f /opt/eduk8s/etc/templates/workshop-variables.yaml "${YTT_ARGS[@]}" -o json >$HOME/.local/share/workshop/workshop-variables.json +# Bail out if workshop instructions are disabled. + +if [ x"$ENABLE_WORKSHOP" != x"true" ]; then + exit 0 +fi + # Bail out if not using the Hugo renderer for instructions. if [ x"$WORKSHOP_RENDERER" != x"local" ]; then @@ -48,6 +54,8 @@ if [ -f $WORKSHOP_DIR/workshop.yaml -o -f $WORKSHOP_DIR/modules.yaml ]; then exit 0 fi +# Generate Hugo configuration. + YTT_ARGS=() YTT_ARGS+=(-f $HOME/.local/share/workshop/workshop-variables.json --file-mark workshop-variables.json:type=data) @@ -56,8 +64,6 @@ if [ -f $WORKSHOP_DIR/config.yaml ]; then YTT_ARGS+=(-f $WORKSHOP_DIR/config.yaml --file-mark config.yaml:path=workshop-configuration.yaml --file-mark config.yaml:type=data) fi -# Generate Hugo configuration. - ytt -f /opt/eduk8s/etc/templates/hugo-configuration.yaml "${YTT_ARGS[@]}" >$HOME/.local/share/workshop/hugo-configuration.yaml # Run Hugo to generate static HTML files.