From 6f7166e10b9f04da511a5a80a74bb76349bb61ab Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Thu, 22 Feb 2024 21:32:40 +1100 Subject: [PATCH 1/4] Avoid separate cluster lookup for environment resource after creation. --- .../src/project/apps/workshops/manager/environments.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/training-portal/src/project/apps/workshops/manager/environments.py b/training-portal/src/project/apps/workshops/manager/environments.py index cfa02490..913e0a32 100644 --- a/training-portal/src/project/apps/workshops/manager/environments.py +++ b/training-portal/src/project/apps/workshops/manager/environments.py @@ -521,9 +521,7 @@ def process_workshop_environment(portal, workshop, position): resource = K8SWorkshopEnvironment(api, environment_body) resource.create() - instance = K8SWorkshopEnvironment.objects(api).get(name=environment.name) - - environment.uid = instance.metadata["uid"] + environment.uid = resource.metadata["uid"] # Finally save the record again. The workshop environment is left in # starting state. It will only be progressed to running state when we From dc45b17e33e1178b8b6a17944822b3481e3c1de0 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Fri, 23 Feb 2024 09:07:16 +1100 Subject: [PATCH 2/4] Log that workshop environment created successfully. --- .../src/project/apps/workshops/manager/environments.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/training-portal/src/project/apps/workshops/manager/environments.py b/training-portal/src/project/apps/workshops/manager/environments.py index 913e0a32..15612f1c 100644 --- a/training-portal/src/project/apps/workshops/manager/environments.py +++ b/training-portal/src/project/apps/workshops/manager/environments.py @@ -523,6 +523,13 @@ def process_workshop_environment(portal, workshop, position): environment.uid = resource.metadata["uid"] + logging.info( + "Successfully created workshop environment %s for workshop %s with uid %s.", + environment.name, + workshop["name"], + resource.metadata["uid"] + ) + # Finally save the record again. The workshop environment is left in # starting state. It will only be progressed to running state when we # receive an event for the workshop environment being modified by the From f5b1b425c63d61bc644b3adfc21bf01fa01e8c33 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Mon, 26 Feb 2024 12:59:35 +1100 Subject: [PATCH 3/4] Log details of analytics event when publishing. --- session-manager/handlers/analytics.py | 2 ++ training-portal/src/project/apps/workshops/manager/analytics.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/session-manager/handlers/analytics.py b/session-manager/handlers/analytics.py index 1f6eb245..a7e41d2a 100644 --- a/session-manager/handlers/analytics.py +++ b/session-manager/handlers/analytics.py @@ -23,6 +23,8 @@ def send_event_to_webhook(url, message): def report_analytics_event(event, data={}): message = None + logging.info("Reporting analytics event %s with data %s.", event, data) + if not ANALYTICS_WEBHOOK_URL: return diff --git a/training-portal/src/project/apps/workshops/manager/analytics.py b/training-portal/src/project/apps/workshops/manager/analytics.py index a5e2bf91..886e5aca 100644 --- a/training-portal/src/project/apps/workshops/manager/analytics.py +++ b/training-portal/src/project/apps/workshops/manager/analytics.py @@ -19,6 +19,8 @@ def send_event_to_webhook(url, message): def report_analytics_event(entity, event, data={}): message = None + logging.info("Reporting analytics event %s with data %s.", event, data) + if not settings.ANALYTICS_WEBHOOK_URL: return From b8c6d1e1a53d4f02371366fa31c3b2ed8c3676e9 Mon Sep 17 00:00:00 2001 From: Graham Dumpleton Date: Mon, 26 Feb 2024 13:27:26 +1100 Subject: [PATCH 4/4] Add details to release notes. --- project-docs/release-notes/version-2.7.0.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/project-docs/release-notes/version-2.7.0.md b/project-docs/release-notes/version-2.7.0.md index 12792f52..f11894b7 100644 --- a/project-docs/release-notes/version-2.7.0.md +++ b/project-docs/release-notes/version-2.7.0.md @@ -205,3 +205,11 @@ Bugs Fixed opaque data secret. This issue was inadvertantly introduced when support was added for providing the CA secret as an actual secret rather than being enmbedded in the data values file when deploying Educates. + +* Addressed possible issue with training portal whereby if a transient error + occurred when looking up workshop environment using Kubernetes REST API + immediately after creation, that database update would be rolled back but + the workshop environment in the cluster would still exist, meaning that an + attempt would me made to use the same workshop environment name the next + time one is created, resulting in a conflict and inability to create any + new workshop environments against that training portal.