From 504cfb3b1e901eba1d466b2961c7a0c6b467d61a Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Mon, 31 Jul 2023 16:21:57 +1000 Subject: [PATCH] Change variable naming for OCI image cache. --- session-manager/handlers/workshopenvironment.py | 8 ++++---- session-manager/handlers/workshopsession.py | 10 +++++----- .../opt/eduk8s/etc/templates/workshop-variables.yaml | 2 +- .../opt/gateway/src/backend/modules/config.ts | 6 +++--- .../opt/renderer/src/backend/modules/config.ts | 4 ++-- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/session-manager/handlers/workshopenvironment.py b/session-manager/handlers/workshopenvironment.py index 4a70e90a..e8c91ce5 100644 --- a/session-manager/handlers/workshopenvironment.py +++ b/session-manager/handlers/workshopenvironment.py @@ -618,15 +618,15 @@ def workshop_environment_create( if xget(workshop_spec, "environment.assets.ingress.enabled", False): assets_repository = f"assets-{workshop_namespace}.{INGRESS_DOMAIN}" - workshop_image_cache = f"image-cache.{workshop_namespace}.svc.{CLUSTER_DOMAIN}" + oci_image_cache = f"image-cache.{workshop_namespace}.svc.{CLUSTER_DOMAIN}" if xget(workshop_spec, "environment.images.ingress.enabled", False): - workshop_image_cache = f"images-{workshop_namespace}.{INGRESS_DOMAIN}" + oci_image_cache = f"images-{workshop_namespace}.{INGRESS_DOMAIN}" environment_downloads_variables = dict( platform_arch=PLATFORM_ARCH, image_repository=image_repository, - workshop_image_cache=workshop_image_cache, + oci_image_cache=oci_image_cache, assets_repository=assets_repository, workshop_name=workshop_name, environment_name=environment_name, @@ -939,7 +939,7 @@ def workshop_environment_create( environment_variables = dict( platform_arch=PLATFORM_ARCH, image_repository=image_repository, - workshop_image_cache=workshop_image_cache, + oci_image_cache=oci_image_cache, assets_repository=assets_repository, service_account=f"{OPERATOR_NAME_PREFIX}-services", workshop_name=workshop_name, diff --git a/session-manager/handlers/workshopsession.py b/session-manager/handlers/workshopsession.py index 8fa06456..69f72382 100644 --- a/session-manager/handlers/workshopsession.py +++ b/session-manager/handlers/workshopsession.py @@ -904,10 +904,10 @@ def resolve_security_policy(name): if xget(workshop_spec, "environment.assets.ingress.enabled", False): assets_repository = f"assets-{workshop_namespace}.{INGRESS_DOMAIN}" - workshop_image_cache = f"image-cache.{workshop_namespace}.svc.{CLUSTER_DOMAIN}" + oci_image_cache = f"image-cache.{workshop_namespace}.svc.{CLUSTER_DOMAIN}" if xget(workshop_spec, "environment.images.ingress.enabled", False): - workshop_image_cache = f"images-{workshop_namespace}.{INGRESS_DOMAIN}" + oci_image_cache = f"images-{workshop_namespace}.{INGRESS_DOMAIN}" image_registry_host = xget(environment_instance.obj, "spec.registry.host") image_registry_namespace = xget(environment_instance.obj, "spec.registry.namespace") @@ -921,7 +921,7 @@ def resolve_security_policy(name): session_variables = dict( platform_arch=PLATFORM_ARCH, image_repository=image_repository, - workshop_image_cache=workshop_image_cache, + oci_image_cache=oci_image_cache, assets_repository=assets_repository, session_id=session_id, session_name=session_name, @@ -1507,8 +1507,8 @@ def resolve_security_policy(name): "value": image_repository, }, { - "name": "WORKSHOP_IMAGE_CACHE", - "value": workshop_image_cache, + "name": "OCI_IMAGE_CACHE", + "value": oci_image_cache, }, { "name": "ASSETS_REPOSITORY", diff --git a/workshop-images/base-environment/opt/eduk8s/etc/templates/workshop-variables.yaml b/workshop-images/base-environment/opt/eduk8s/etc/templates/workshop-variables.yaml index 4e0b0a07..3a3bbe4a 100644 --- a/workshop-images/base-environment/opt/eduk8s/etc/templates/workshop-variables.yaml +++ b/workshop-images/base-environment/opt/eduk8s/etc/templates/workshop-variables.yaml @@ -107,7 +107,7 @@ #@ add_param_from_environ("amplitude_tracking_id") #@ add_param_from_environ("image_repository") -#@ add_param_from_environ("workshop_image_cache") +#@ add_param_from_environ("oci_image_cache") #@ add_param_from_environ("assets_repository") #@ add_param_from_environ("workshop_name") #@ add_param_from_environ("session_name") 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 51cd88b4..58fe63b7 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 @@ -67,7 +67,7 @@ const RESTART_URL = process.env.RESTART_URL const FINISHED_MSG = process.env.FINISHED_MSG const IMAGE_REPOSITORY = process.env.IMAGE_REPOSITORY || "registry.default.svc.cluster.local" -const WORKSHOP_IMAGE_CACHE = process.env.WORKSHOP_IMAGE_CACHE || "workshop-images" +const OCI_IMAGE_CACHE = process.env.OCI_IMAGE_CACHE || "workshop-images" const ASSETS_REPOSITORY = process.env.ASSETS_REPOSITORY || "workshop-assets" const SERVICES_PASSWORD = process.env.SERVICES_PASSWORD @@ -163,7 +163,7 @@ export let config = { kubernetes_token: kubernetes_token(), image_repository: IMAGE_REPOSITORY, - workshop_image_cache: WORKSHOP_IMAGE_CACHE, + oci_image_cache: OCI_IMAGE_CACHE, assets_repository: ASSETS_REPOSITORY, services_password: SERVICES_PASSWORD, @@ -179,7 +179,7 @@ function substitute_session_params(value: any) { value = value.split("$(platform_arch)").join(config.platform_arch) value = value.split("$(image_repository)").join(config.image_repository) - value = value.split("$(workshop_image_cache)").join(config.workshop_image_cache) + value = value.split("$(oci_image_cache)").join(config.oci_image_cache) value = value.split("$(assets_repository)").join(config.assets_repository) value = value.split("$(environment_name)").join(config.environment_name) value = value.split("$(workshop_namespace)").join(config.workshop_namespace) 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 ea71faa1..d890fd55 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 @@ -43,7 +43,7 @@ export let config = { platform_arch: process.env.PLATFORM_ARCH || "", image_repository: process.env.IMAGE_REPOSITORY || "registry.default.svc.cluster.local", - workshop_image_cache: process.env.WORKSHOP_IMAGE_CACHE || "workshop-images", + oci_image_cache: process.env.OCI_IMAGE_CACHE || "workshop-images", assets_repository: process.env.ASSETS_REPOSITORY || "workshop-assets", workshop_name: process.env.WORKSHOP_NAME || "workshop", session_name: process.env.SESSION_NAME || "workshop", @@ -116,7 +116,7 @@ export let config = { config.variables.push({ name: "platform_arch", content: config.platform_arch }) config.variables.push({ name: "image_repository", content: config.image_repository }) -config.variables.push({ name: "workshop_image_cache", content: config.workshop_image_cache }) +config.variables.push({ name: "oci_image_cache", content: config.oci_image_cache }) config.variables.push({ name: "assets_repository", content: config.assets_repository }) config.variables.push({ name: "workshop_name", content: config.workshop_name }) config.variables.push({ name: "session_name", content: config.session_name })