26 Commits

Author SHA1 Message Date
Alex Ellis (OpenFaaS Ltd)
16834ccbf4 Change to temporary redirect
When exposed via a tunnel, if the underlying service is
switched, the browser remembers the / => /ui redirection
so this can be changed to a temporary redirect.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2025-02-26 12:43:22 +00:00
Alex Ellis (OpenFaaS Ltd)
2fb748e03d Allow CE gateway to proxy telemetry handler from OEM/Pro backend
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2024-11-29 14:51:19 +00:00
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)
1379805240 Switch to Default HTTP client for Prometheus queries
A new / empty client isn't necessary for these queries.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2024-08-07 09:41:20 +01:00
Alex Ellis (OpenFaaS Ltd)
546bfee9dc Add User-Agent to Prometheus Queries
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2024-08-07 09:39:31 +01:00
Alex Ellis (OpenFaaS Ltd)
68ec0f59d6 Migrate to latest faas-provider version
Adds CRUD for namespaces and moves namespace for delete/
scale to the body from the query string.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-07-07 09:52:36 +01:00
Alex Ellis (OpenFaaS Ltd)
00613347f8 Implement scaling ranges
Scaling ranges keep the OpenFaaS CE gateway's requests to
within the intended bounds already implemented in other
components.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-06-07 16:05:37 +01:00
Alex Ellis (OpenFaaS Ltd)
a128df471f Function-based metrics for CE
OpenFaaS CE exposes metrics about function invocations and
about the gateway itself. OpenFaaS Pro has a richer set of
metrics including HTTP RED.

See also: https://docs.openfaas.com/architecture/metrics/

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2023-01-28 09:10:48 +00:00
Alex Ellis (OpenFaaS Ltd)
4f9c61b5d2 Deprecate external auth plugins
There is no need for OpenFaaS CE to have external auth plugins
since this added extra overhead and was never used.

OpenFaaS Pro retains the option so it can use the OIDC
auth plugin.

It's still possible, as it ever was to put a proxy in front
of any HTTP server like the gateway.

Tested with a local KinD cluster, auth still worked for the
API and UI.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-01-11 12:22:12 +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)
f3599f4699 Apply gofmt
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-12-14 11:40:43 +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)
9fccc67b9c Remove OpenFaaS Pro metrics from OpenFaaS CE
* Removes service min and target metrics from the CE gateway

OpenFaaS Pro metrics are no longer required in OpenFaaS CE
since there is an OpenFaaS Pro gateway available.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-08-30 11:30:58 +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)
cc2f38938e Add HTTP status code to histogram
The histogram for gateway_functions_seconds excluded the status
code that gives important information for setting up SLOs.

Fixes: #1725

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2022-06-01 10:14:18 +01:00
Alex Ellis (OpenFaaS Ltd)
d85d5e7239 Export new metrics for OpenFaaS Pro scaling
* Add service target metric
* Add service min replicas metric
* Add scale type metric

These combined allow new auto-scaling modes and parameters
for OpenFaaS Pro customers.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2022-01-24 14:30:08 +00:00
Alex Ellis (OpenFaaS Ltd)
048a90a150 Reduce cache expiry
Reduce cache expiry to help support issues where a function
may be scaled down by a user, when it is still in use.

The 5s cache meant that all requests would fail until the
expiry. The 250ms setting is a 20x reduction.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-26 12:24:55 +00:00
Alex Ellis (OpenFaaS Ltd)
d5b98a7078 Restore the X-Call-Id for synchronous calls
This appears to have been removed inadvertently whilst
adding scale from zero logic into the gateway.

Going forward, synchronous and asynchronous calls will have a
header populated.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-02-10 09:47:09 +00:00
Alex Ellis (OpenFaaS Ltd)
f98213a428 Remove git commit message from binary
This appears to have broken CI at least three times now and
prevented us from shipping a release binary for a tag.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-01-31 09:23:55 +00:00
Alex Ellis (OpenFaaS Ltd)
2e2250afe8 Use a placeholder commit message for development
The faas-cli throws an error because it always expects a
commit_message for the gateway version, and if it's null - it
will crash. This only affects local development.

The code in faas-cli should be changed to use a struct instead
of casting to an interface.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-01-20 12:02:15 +00:00
Alex Ellis (OpenFaaS Ltd)
4ced7cacd0 Update scaling polling interval
Polls every 100 ms instead of every 50ms for use with a new
faas-netes PR:

https://github.com/openfaas/faas-netes/pull/726

The call is much faster now, so this request should me made
at a lower frequency.

Also adds error handling for URL building in the external
service query code.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-12-10 14:00:31 +00:00
Vivek Singh
c0ba41ce33 Use default namespace in metrics exporter
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2020-11-02 10:35:57 +00:00
Vivek Singh
f7b02b47f8 Add namespace in function name for metrics
This commit adds namespace in function names while logging metrics to
prometheus, irrespective of the function is invoked with namespace suffix
or not.

This is also required to add multiple namespace support to faas-idler

https://github.com/openfaas-incubator/faas-idler/issues/37 which is part
of https://github.com/openfaas/faas-netes/issues/511

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2020-11-02 10:35:57 +00:00
Alex Ellis (OpenFaaS Ltd)
18f6c720b5 Extract a caching function_query type
This type abstracts the function_query type and introduces an
interface for testing and substitution.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-04-22 15:26:42 +01:00
Alex Ellis (OpenFaaS Ltd)
2bfca6d848 Publish to multiple topics
Enables publishing to various topics according to annotations
on the functions. The function cache is moved up one level so
that it can be shared between the scale from zero code and the
queue proxy.

Unit tests added for new internal methods.

Tested e2e with arkade and the newest queue-worker and RC
gateway image with two queues and an annotation on one of the
functions of com.openfaas.queue. It worked as expected including
with multiple namespace support.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-04-22 15:26:42 +01:00
Alex Ellis (OpenFaaS Ltd)
96812d2cd8 Record metrics for invocations when they start
* This experimental patch records metrics as invocations start
so that the metrics can be used to make better scale to zero
decisions in faas-idler.

Tested with Kubernetes on a single-node cluster, metrics
reported as expected. Existing metrics still report.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-03-12 13:51:43 +00:00