mirror of
https://github.com/openfaas/faas.git
synced 2025-06-21 14:23:25 +00:00
Add direct_functions mode to gateway for tuning
Adds a pair of configuration options for performance tuning. The gateway can now invoke functions directly and can bypass the provider. See updated table in README.md for configuration values. BaseURLResolver is added with unit tests that decouples resolving upstream URL from the reverse proxy client code. - SingleHostBaseURLResolver resolves a single upstream host - FunctionAsHostBaseURLResolver resolves host based upon conventions within the URL of the request to a function for direct access Tested with Kubernetes (faas-netes) and faas-swarm through UI, CLI calling system endpoints and functions directly. Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
This commit is contained in:
@ -102,6 +102,9 @@ func (ReadConfig) Read(hasEnv HasEnv) GatewayConfig {
|
||||
cfg.PrometheusHost = prometheusHost
|
||||
}
|
||||
|
||||
cfg.DirectFunctions = parseBoolValue(hasEnv.Getenv("direct_functions"))
|
||||
cfg.DirectFunctionsSuffix = hasEnv.Getenv("direct_functions_suffix")
|
||||
|
||||
return cfg
|
||||
}
|
||||
|
||||
@ -131,6 +134,12 @@ type GatewayConfig struct {
|
||||
|
||||
// Port to connect to Prometheus.
|
||||
PrometheusPort int
|
||||
|
||||
// If set to true we will access upstream functions directly rather than through the upstream provider
|
||||
DirectFunctions bool
|
||||
|
||||
// If set this will be used to resolve functions directly
|
||||
DirectFunctionsSuffix string
|
||||
}
|
||||
|
||||
// UseNATS Use NATSor not
|
||||
|
Reference in New Issue
Block a user