Skip to content

Commit

Permalink
fix: apply cluster settings to context
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Hare committed May 21, 2024
1 parent eb26e8b commit 9a46a18
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions gateway/rest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func newRouter(log log.Logger, addr sdk.Address, pclient provider.Client, ctxCon

// POST /lease/<lease-id>/shell
lrouter.HandleFunc("/shell",
leaseShellHandler(log, pclient.Cluster()))
leaseShellHandler(log, pclient.Cluster(), ctxConfig))

return router
}
Expand Down Expand Up @@ -306,12 +306,14 @@ type leaseShellResponse struct {
Message string `json:"message,omitempty"`
}

func leaseShellHandler(log log.Logger, cclient cluster.Client) http.HandlerFunc {
func leaseShellHandler(log log.Logger, cclient cluster.Client, clusterSettings map[any]any) http.HandlerFunc {
return func(rw http.ResponseWriter, req *http.Request) {
leaseID := requestLeaseID(req)

leaseCtx := fromctx.ApplyToContext(req.Context(), clusterSettings)

// check if deployment actually exists in the first place before querying kubernetes
status, err := cclient.LeaseStatus(req.Context(), leaseID)
status, err := cclient.LeaseStatus(leaseCtx, leaseID)
if err != nil {
log.Error("failed checking deployment activity", "err", err)
rw.WriteHeader(http.StatusInternalServerError)
Expand Down

0 comments on commit 9a46a18

Please sign in to comment.