29 Commits

Author SHA1 Message Date
Alex Ellis (OpenFaaS Ltd)
49053feac7 Clarify EULA applies to this project since 2019
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2024-11-18 21:20:38 +00:00
Alex Ellis (OpenFaaS Ltd)
a7d486eee6 Make OpenFaaS CE use the provider for load-balancing
This change removes the direct functions option which was
used originally for Docker Swarm. The Community Edition will
rely on the faas provider - faas-netes / faasd for load-balancing
of requests.

Direct Functions is required in order to delegate load-balancing
to Istio, Linkerd or some other kind of service mesh.

Tested by deploying a modified gateway image to a KinD cluster,
deploying the env function, and scaling to two replicas. This
balanced the load between the two pods by printing out the names
and then I ran a test with hey which returned 200s for all the
requests.

The prober which was part of the Istio support is no longer
required in the CE gateway so is removed for simplicity.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-01-11 12:12:26 +00:00
Alex Ellis (OpenFaaS Ltd)
4604271076 Introduce welcome message and change default timeout
The welcome message shows the difference between
Pro and CE.

The timeout of 8 seconds was never going to be useful as
a default, so changing to 60 seconds.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-08-30 14:02:44 +01:00
Alex Ellis (OpenFaaS Ltd)
88eea5f62e Feature for probing functions
Introduces a single-flight call to a function's health
endpoint to verify that it is registered with an Istio
sidecar (Envoy) before letting the invocation through.

Results are cached for 5 seconds, before a probe is
required again.

Tested without Istio, with probe_functions environment
variable set to true, I saw a probe execute in the logs.

Fixes: #1721 for Istio users.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-07-07 10:35:07 +01:00
Alex Ellis (OpenFaaS Ltd)
8a5b3123e0 Remove Swarm resources from faas repo
This is part of the following activity:

https://github.com/openfaas/docs/pull/249

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-12-16 09:58:26 +00:00
Bruno Miguel Custódio
03dc8824d2 Support customising the NATS Streaming channel.
Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
2019-12-10 11:15:52 +00:00
Bruno Miguel Custódio
365f459b3f Allow for customizing the name of the target NATS Streaming cluster.
Signed-off-by: Bruno Miguel Custódio <brunomcustodio@gmail.com>
2019-11-25 10:52:39 +00:00
Alex Ellis (OpenFaaS Ltd)
238ce1be23 Add feature for invoking namespaced functions
When coupled with the latest version of faas-netes, the gateway
can now invoke, query and deploy functions into alternative
namespaces.

Tested e2e by creating a namespace "fn" and deploying, then
invoking a function deployed there and in the default namespace.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-09-20 18:38:55 +01:00
Lucas Roesler
e7e91ecd15 Implement log proxy handler
**What**
- Implement log handler method that will hijack the connection and clear
timeouts to allow long lived streams
- Proxies requests to the logs provider and returns the response
unmodified

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2019-07-06 10:42:46 +01:00
Alex Ellis
a66097a9f9 Add config options for auth proxy
Adds two new environment variables and unit tests to validate
positive and default use-cases.

auth_proxy_url
auth_proxy_pass_body

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2019-06-05 18:13:49 +01:00
Alex Ellis (VMware)
299e5a5933 Read config values from environment for max_conns tuning
- max_conns / idle / per host are now read from env-vars and have
defaults set to 1024 for both values
- logging / metrics are collected in the client transaction
rather than via defer (this may impact throughput)
- function cache moved to use RWMutex to try to improve latency
around locking when updating cache
- logging message added to show latency in running GetReplicas
because this was observed to increase in a linear fashion under
high concurrency
- changes tested against 3-node bare-metal 1.13 K8s cluster
with kubeadm

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2019-02-04 11:50:25 +00:00
Alex Ellis
bd39b9267a Update comments
- updates comments and adds where missing
- updates locks so that unlock is done via defer instead of
at the end of the statement
- extracts timeout variable in two places
- remove makeClient() unused method from metrics package

No-harm changes tested via go build.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-10-03 13:16:28 +01:00
Alex Ellis (VMware)
2f98ca8802 Review changes for HTTP paths
This reviews the code and fixes up suggestions made by team for
the HTTP paths PR #789.

- Removed feature-flag (this is backwards-compatible, so I see
no value in adding the flag)
- There was a URL transform happening for calls proxied to the
back end, I changed this for the nil-transform - i.e. it does not
change anything in the URL
- Introduced variables to describe the regex indicies used in
the URL trimming.

Tested with Docker Swarm with a ruby-microservice, with
system calls and with function calls using the UI.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-08-29 12:41:04 +01:00
Thomas E Lackey
decf9addb3 Make 'URLPathTransformer' interface and implementation to do the function prefix trimming instead of baking it in. Also add a configuration option, 'pass_url_path_to_functions' to control whether the full path is passed to the functions or not.
Signed-off-by: Thomas E Lackey <telackey@bozemanpass.com>
2018-08-29 12:41:04 +01:00
Alex Ellis (VMware)
c58af8da56 Disable scaling from zero by default
This disables the scaling proxy by default since it is not the
default user-experience and is still under refinement.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-07-20 11:39:36 +01:00
Alex Ellis (VMware)
a1c2c553a5 Add scale_from_zero flag
Added scale_from_zero to config, docs and wrote unit test for the
value.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-07-20 11:39:36 +01:00
Vivek Singh
e55c018c17 Update default secret mount path to /run/secrets/
This commit reverts the changes done in #738 to update the default
secret mount path to `/run/secrets/`

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2018-07-02 19:22:59 +01:00
Vivek Singh
ced39bcda7 Updated default secret mount path value
This changes updates the secret mount path default value to
/var/openfaas/secrets at serveral places. It has been changed
from /run/secrets/ to /var/openfaas/secrets after version 0.8.2

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2018-06-28 21:37:10 +03:00
Alex Ellis (VMware)
8133414183 Read secrets from variable path
This change enables secrets to be read from any mount on disk
rather than hard-coding a certain location which suits Swarm or
K8s. The default value if not specified will look in the Swarm
location of /run/secrets/

README.md (docs) updated and set to off by default.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-05-23 11:42:42 +01:00
Alex Ellis (VMware)
a38931ce69 Enable basic auth on gateway
Fixes https://github.com/openfaas/faas/issues/687 allowing the
gateway to handle the responsibility of basic auth for when it is
in use.

To enable set basic_auth env-var to true and then mount two
secrets or plaintext files under /var/secrets/

basic_auth_user, basic_auth_password

Tested with faas-cli list/deploy and with Safari browser.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-05-23 11:42:42 +01:00
Alex Ellis
0c7e59fe8a 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>
2018-03-23 16:35:37 +00:00
Alex Ellis
6efaee5b4f Add upstream_timeout as env-var
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-05 12:49:25 +00:00
Vivek Singh
b12a4d0bf2 adds Go durations for timeout configs
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>

applied go fmt on config_test file

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>

removes extra line in config_test

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2018-02-10 18:46:23 +00:00
Alex Ellis
12a0c75e91 Add unit tests to build. Pin to specific Alpine tag.
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-10-26 21:02:50 +01:00
Elliott Beach
06f0a2c953 add docs for GatewayConfig like WatchdogConfig
Signed-off-by: Elliott Beach <elliott2.71828@gmail.com>
2017-10-23 16:22:51 +01:00
Alex Ellis
5339fdcdbe Query Prometheus API for stats.
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-09-07 22:42:27 +01:00
Alex Ellis
bd146f526c Sync async_nats work with master
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-08-29 19:40:08 +01:00
Alex Ellis
c5815d36ab add_missing_mit_header_27_aug
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-08-27 22:37:19 +01:00
Alex
35a15cff01 Support external URL for FaaS functions 2017-08-08 09:14:46 +01:00