-
Notifications
You must be signed in to change notification settings - Fork 6
Conversation
The `dispatch` request type handles the majority of all runtime-bound requests
This PR will trigger a minor release when merged. |
Codecov Report
@@ Coverage Diff @@
## main #704 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 15 15
Lines 348 348
=========================================
Hits 348 348
Continue to review full report at Codecov.
|
I don't quite understand the problem. the action invokes stay in the same environment. eg: a request to: https://helix-pages.anywhere.run/helix-services/dispatch@v4 will invoke the dispatch on the |
Let's take
Now,
or:
|
we don't have namespaces in AWS, and all helix-services are mounted in the
no. that would be wrong. I still don't understand the problem :-) |
We deploy helix-pages (html action, etc) and helix-services (e.g. purge) differently in OW. I'd assume that we would have the same separation in AWS, i.e. different subdomains for anywhere.run. The question is how to reconcile this here. |
ah, ok. in AWS we just ignore the namespaces, and hope there is no collision in the packages :-) |
Ok, for now I will assume the specified subdomain has all the actions and later we can build adobe/helix-deploy#91 |
depends on adobe/helix-publish#704 and is probably broken. The `universal` strain can only be selected via header, so there is little risk of breaking things until you ask for it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm..there is a lot of duplicated code that calculates the universal/namespace vars. can't this be done in a function?
VCL does not have function, it only has subroutines, which makes this difficult. Ideally, we'd have functions that return a struct with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems ok (but to be honest: I don't really understand it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@stefan-guggisberg I've added some elaboration.
# We need the action root for the next bit | ||
call hlx_action_root; | ||
|
||
if (req.http.X-Action-Root ~ "(^|^https://)([^/:\.]+)(/|\.([^/]+)/)([^/]+)") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pattern supports both formats of the package
parameter: namespace/package
and https://namespace.anywhere.run/package
set var.universal = true; | ||
set var.hostname = var.namespace + "." + re.group.4; | ||
set req.backend = F_UniversalRuntime; | ||
set req.http.X-Backend-Host = var.hostname; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are using the universal runtime, so we need to store the backend hostname, e.g. namespace
@@ -555,8 +581,8 @@ sub hlx_type_static_url { | |||
set var.static_version = {"const:static_version"}; | |||
} | |||
|
|||
set req.http.X-Action-Root = "/api/v1/web/" + table.lookup(secrets, "OPENWHISK_NAMESPACE") + "/helix-services/static@" + var.static_version; | |||
set req.http.X-Backend-URL = req.http.X-Action-Root | |||
set req.http.X-Backend-URL = if(var.universal, "/", "/api/v1/web" + "/" + var.namespace) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add the /api/v1/web/${namespace}
prefix for OpenWhisk – Universal Runtime does not need it.
@@ -1761,6 +1910,19 @@ sub hlx_bereq { | |||
} else { | |||
set bereq.http.hlx-forwarded-host = req.http.X-Orig-Host; | |||
} | |||
} elsif (req.backend == F_UniversalRuntime) { | |||
// Set the hostame for the universal Runtime service | |||
set bereq.http.Host = req.http.X-Backend-Host; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the backend hostname set here https://github.com/adobe/helix-publish/pull/704/files#diff-9e59debf5608a9bdb1f1a87b891b2f995823ea79254a122b8d1fcb2bb1f69785R567 (for instance)
As *.anywhere.run
will always go to Fastly, setting the subdomain name here allows Fastly to pick the correct gateway service.
🎉 This PR is included in version 8.2.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Adds support for the universal runtime.
Request types:
dispatch
static_url
static
purge
cgi
query
embed
will be done later, needs support in helix-shared.preflight
content
@tripodsan for
static_url
static
purge
query
embed
we rely on the OpenWhisk linking feature that we have not replicated yet inhelix-dispatch
. Should we just hardcode a hostname (a.k.a. namespace) such ashelix-shared.anywhere.run
? We'd need to make sure the corresponding actions are deployed to this service.