From 16c130a1154b7138b98888e1ad5c1c725eeb3803 Mon Sep 17 00:00:00 2001 From: Matt Oswalt Date: Sun, 3 May 2020 16:03:24 -0700 Subject: [PATCH 1/3] Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response Signed-off-by: Matt Oswalt --- api/exp/definitions/livelesson.proto | 15 ++++++++------- api/exp/definitions/livelesson.swagger.json | 3 +++ api/exp/livelessons.go | 15 ++++++++++----- api/exp/swagger/swagger.pb.go | 3 +++ db/models/livelesson.go | 1 + scheduler/requests.go | 7 +++++-- 6 files changed, 30 insertions(+), 14 deletions(-) diff --git a/api/exp/definitions/livelesson.proto b/api/exp/definitions/livelesson.proto index 17fd59b6..b5081fba 100644 --- a/api/exp/definitions/livelesson.proto +++ b/api/exp/definitions/livelesson.proto @@ -76,16 +76,17 @@ message LiveLesson { int32 CurrentStage = 6; string GuideContents = 7; string GuideType = 8; + string GuideDomain = 9; - string Status = 9; + string Status = 10; - bool Error = 10; - int32 HealthyTests = 11; - int32 TotalTests = 12; + bool Error = 11; + int32 HealthyTests = 12; + int32 TotalTests = 13; - string Diagram = 13; - string Video = 14; - string StageVideo = 15; + string Diagram = 14; + string Video = 15; + string StageVideo = 16; } message LiveLessons { diff --git a/api/exp/definitions/livelesson.swagger.json b/api/exp/definitions/livelesson.swagger.json index 65fd94a3..46e84bfc 100644 --- a/api/exp/definitions/livelesson.swagger.json +++ b/api/exp/definitions/livelesson.swagger.json @@ -175,6 +175,9 @@ "GuideType": { "type": "string" }, + "GuideDomain": { + "type": "string" + }, "Status": { "type": "string" }, diff --git a/api/exp/livelessons.go b/api/exp/livelessons.go index 2179b88e..b5fa7423 100644 --- a/api/exp/livelessons.go +++ b/api/exp/livelessons.go @@ -208,11 +208,16 @@ func (s *AntidoteAPI) RequestLiveLesson(ctx context.Context, lp *pb.LiveLessonRe } newLL := &models.LiveLesson{ - ID: newID, - SessionID: lp.SessionId, - AntidoteID: s.Config.InstanceID, - LessonSlug: lp.LessonSlug, - GuideType: string(lesson.Stages[lp.LessonStage].GuideType), + ID: newID, + SessionID: lp.SessionId, + AntidoteID: s.Config.InstanceID, + LessonSlug: lp.LessonSlug, + GuideType: string(lesson.Stages[lp.LessonStage].GuideType), + + // The front-end will only use this if GuideType is jupyter, but since it will not change, it makes + // sense to just set it here. + // TODO(mierdin): This needs to be coordinated with the creation of the jupyter ingress in requests.go + GuideDomain: fmt.Sprintf("%s-jupyterlabguide-web.%s", nsName, s.Config.HEPSDomain), LiveEndpoints: liveEndpoints, CurrentStage: lp.LessonStage, Status: models.Status_INITIALIZED, diff --git a/api/exp/swagger/swagger.pb.go b/api/exp/swagger/swagger.pb.go index dc4db538..444b0d0b 100644 --- a/api/exp/swagger/swagger.pb.go +++ b/api/exp/swagger/swagger.pb.go @@ -921,6 +921,9 @@ Livelesson = `{ "GuideType": { "type": "string" }, + "GuideDomain": { + "type": "string" + }, "Status": { "type": "string" }, diff --git a/db/models/livelesson.go b/db/models/livelesson.go index b7fbd344..11a1a357 100644 --- a/db/models/livelesson.go +++ b/db/models/livelesson.go @@ -14,6 +14,7 @@ type LiveLesson struct { CurrentStage int32 `json:"LessonStage"` GuideContents string `json:"GuideContents"` GuideType string `json:"GuideType"` + GuideDomain string `json:"GuideDomain"` Status LiveLessonStatus `json:"Status"` CreatedTime time.Time `json:"CreatedTime"` Error bool `json:"Error"` diff --git a/scheduler/requests.go b/scheduler/requests.go index 94c535b1..ecd651d2 100644 --- a/scheduler/requests.go +++ b/scheduler/requests.go @@ -187,13 +187,16 @@ func (s *AntidoteScheduler) createK8sStuff(sc ot.SpanContext, req services.Lesso } ll.LiveEndpoints[jupyterEp.Name] = jupyterEp + nsName := generateNamespaceName(s.Config.InstanceID, req.LiveLessonID) + _, err := s.createIngress( span.Context(), ns.ObjectMeta.Name, jupyterEp, &models.LivePresentation{ - Name: "web", - Port: 8888, + Name: "web", + Port: 8888, + HepDomain: fmt.Sprintf("%s-jupyterlabguide-web.%s", nsName, s.Config.HEPSDomain), }, ) if err != nil { From ec81cffe37e8d66ca95607062e76d74eb60f9a0f Mon Sep 17 00:00:00 2001 From: Matt Oswalt Date: Sun, 3 May 2020 16:04:39 -0700 Subject: [PATCH 2/3] Update changelog Signed-off-by: Matt Oswalt --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 50cba537..35c452d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Revert back to upstream bridge CNI plugin [#174](https://github.com/nre-learning/antidote-core/pull/174) - Fix excessive span exports with stats package [#175](https://github.com/nre-learning/antidote-core/pull/175) - Provide HEPS domain via LiveLesson API [#176](https://github.com/nre-learning/antidote-core/pull/176) +- Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response [#177](https://github.com/nre-learning/antidote-core/pull/177) ## v0.6.0 - April 18, 2020 From 7d815b659f6250b8487903811b9e3071455d3adc Mon Sep 17 00:00:00 2001 From: Matt Oswalt Date: Sun, 3 May 2020 16:06:36 -0700 Subject: [PATCH 3/3] Fix changelog Signed-off-by: Matt Oswalt --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66773b17..87ae1d66 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## In development +- Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response [#177](https://github.com/nre-learning/antidote-core/pull/177) ## v0.6.1 - May 03, 2020 @@ -11,7 +12,6 @@ - Revert back to upstream bridge CNI plugin [#174](https://github.com/nre-learning/antidote-core/pull/174) - Fix excessive span exports with stats package [#175](https://github.com/nre-learning/antidote-core/pull/175) - Provide HEPS domain via LiveLesson API [#176](https://github.com/nre-learning/antidote-core/pull/176) -- Add domain for HTTP-based lesson guides like jupyter notebooks in the livelesson response [#177](https://github.com/nre-learning/antidote-core/pull/177) ## v0.6.0 - April 18, 2020