481 Commits

Author SHA1 Message Date
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
Vivek Singh
82cd46ef2a Update version info endpoint
This commits updates version endpoint to use ProviderInfo and VersionInfo structs from
faas-provider.GatewayInfo now uses ProviderInfo and VersionInfo structs. GatewayInfo is
left within gateway. Consumer of this endpoint should use typed struct GatewayInfo to
parse response.

Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2021-01-30 14:53:57 +00:00
Alex Ellis (OpenFaaS Ltd)
7ce266adc0 Migrate to Go modules
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2021-01-21 19:04:22 +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)
3f98c856e5 Remove Swarm references
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-12-16 10:01:21 +00: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
Alistair Hey
ca3d53c0a5 Add publish step to github actions
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-12-10 14:54:38 +00:00
Alistair Hey
e3b18e6324 Convert Basic-Auth to multi-arch
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-12-10 14:54:38 +00:00
Alistair Hey
a5583074e0 Convert Gateway to Github Actions
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-12-10 14:54:38 +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
Alex Ellis (OpenFaaS Ltd)
9bbb25e3c7 Fix a bug that caused the services list to keep growing
This patch changes the code which looks up service and appends
them to the Exporter's list. It previously would create an
endless list and cause a memory leak.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-12-05 12:57:47 +00:00
Alistair Hey
7b6cc60bd9 Fix Invocation count wrong for multiple namespace
Fixes https://github.com/openfaas/faas/issues/1413
Fixes https://github.com/openfaas/faas-netes/issues/707

This fixes the Gateway UI not updating the
invocation count automatically without a page reload.

Tested by deploying on a local cluster and making sure invocations go up
with and without namespace suffix

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-11-17 10:04:33 +00:00
Vivek Singh
c9c2b39601 Use namespace while filtering metric result
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2020-11-02 10:35:57 +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)
8f76b77857 Closes #1568
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-10-29 10:01:38 +00:00
Alex Ellis (OpenFaaS Ltd)
f612947df7 Remove deprecated Angular/material versions
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-10-14 15:33:51 +01:00
Alex Ellis (OpenFaaS Ltd)
f864d88bb3 Add maps for AngularJS
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-10-14 15:33:15 +01:00
Alex Ellis (OpenFaaS Ltd)
66c89c7b8a Upgrade Angular to 1.8.0
* Updates AngularJS to 1.8.0
* Updates the MaterialUI theme to 1.2.1
* Fixes: #1576

Tested by running the gateway locally, with NATS, Prometheus,
and a gateway port-forwarded from a local KinD cluster.

The UI rendered and the newer files were served. Functions
could be deployed and invoked from the store and CLI.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-10-14 15:31:16 +01:00
Alex Ellis (OpenFaaS Ltd)
11ff356cce Remove service namespace from scale request
This field doesn't appear to be used and is supplied via the
querystring which faas-netes (the only ns-enabled provider
already consumes)

Related to PR:

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

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-07-20 10:19:26 +01:00
Alex Ellis (OpenFaaS Ltd)
997c6704b5 Remove unused value
Removes an unused value in the alerthandler.go file, shown
via lgtm.com.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-05-06 18:35:49 +01:00
Alex Ellis (OpenFaaS Ltd)
5741610f31 Return cached query when hit
The code was calling into the cache twice, even if the first
call was a cache hit and not a miss.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-05-06 18:32:51 +01:00
Alex Ellis (OpenFaaS Ltd)
c45334657a Handle err in queue_proxy
Found on lgtm.com

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-05-06 18:32:17 +01: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)
a7c6c39200 Add QueueName to async requests
The queue's name will be consumed by the queue worker to
publish to other topics / slow queues.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-04-22 12:38:58 +01:00
Alex Ellis (OpenFaaS Ltd)
9bde25aedb Bump queue-worker and NATS
NATS moved its primary library to: github.com/nats-io/stan.go

This commit synchronises the library in the gateway to match the
queue worker.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-04-22 10:14:01 +01:00
Alex Ellis (OpenFaaS Ltd)
c44cb74cc7 Propagate context to upstream request
Propagates the context to upstream requests so that
cancellation can cascade.

Closes: #1501 by @SpaWn2KiLl which was not signed-off.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-04-05 09:44:31 +01:00
Alex Ellis (OpenFaaS Ltd)
f652692966 Fix test on help description message
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-03-12 14:02:57 +00:00
Alex Ellis (OpenFaaS Ltd)
37bf15e508 Namespace invocation_total
This should be a "no-harm" change to use the namespace/sub-
system definition for CounterOpts.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-03-12 13:51:43 +00:00
Alex Ellis (OpenFaaS Ltd)
c4f924cfb5 Update Started variable to GatewayFunctionInvocationStarted
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2020-03-12 13:51:43 +00: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
Alistair Hey
6880fdc524 Fix issue with Namespace suffix on Gateway UI
There was a case where a deployment with a single namespace on
faas-netes would show the namespace suffix for all functions.  we didn't
need to show this because the gateway will proxy to the default
namespace for fns without the namespace siffix.

This was tested on Swarm (no suffix), faas-netes (single namespace, no
suffix) and faas-netes, multi-ns, suffix shown.

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-03-05 15:38:17 +00:00
Alistair Hey
b4bed58b66 Fix padding on Fn Store Gateway UI
The padding was off on the Gateway UI for the function
Store popup.

I have removed the 0padding css class from this element and left
it on the elements that require it

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2020-03-05 15:38:17 +00:00
Lars Lehtonen
b4a6872c04 gateway/handlers: fix use of testing.T inside goroutine
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2020-02-22 19:03:24 +00:00
Thomas Schmidt
67598e58c5 Update projects to use Go 1.13
Fixes #1442

Signed-off-by: Thomas Schmidt <thomaschmidt@gmail.com>
2020-02-22 19:01:49 +00:00
hasheddan
5fa7e0f8a0 Use license-check docker image instead of curl
Optimizes Docker builds by copying from license-check Docker image
instead of using curl to download the tool.

Signed-off-by: hasheddan <georgedanielmangum@gmail.com>
2020-02-04 15:51:03 +00:00
Vivek Singh
9fd8a59b89 Update logs to reudce verbosity and consistency
Signed-off-by: Vivek Singh <vivekkmr45@yahoo.in>
2020-01-24 12:39:16 +00:00
Alex Ellis (OpenFaaS Ltd)
80b6976c10 Update Golang versions to 1.12
Tested with local Docker build for each component.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-12-27 17:53:19 +00:00
Alex Ellis (OpenFaaS Ltd)
b45e2a52a4 Bump alpine to 3.11
There's a new release which appears to have no apparent down-
sides or breakages.

https://www.alpinelinux.org/posts/Alpine-3.11.2-released.html

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-12-27 10:08:02 +00:00
Lucas Roesler
76e463a7a0 Always apply the function prefix trim for async functions
**What**
- Always apply the `FunctionPrefixTrimmingURLPathTransformer` when
  enqueueing async function requests. This ensures that the context
  information sent to the function is correct

Resolves #85

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2019-12-25 17:40:39 +00:00
Alistair Hey
59b7839236 Change how and when we fetch and parse namespace info
Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-12-19 10:32:46 +00:00
Alistair Hey
04fead5eab Hide the namespace selector when on swarm or <2 K8s ns
We now hide the new namespace dropdown selector when
there is only 1 namespace, or when we are on swarm
This is also hidden in the function create page and
the function detail page

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-12-15 17:06:20 +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
Alistair Hey
2f683ba236 Add Namespace indicator on Function page part of #1379
This is a precursor to adding a dropdown for namespaces
selection (#1379)

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-11-25 13:58:33 +00:00
Alistair Hey
7e1af57921 Allow users to create functions in a non-default NS from ui
This allows a uswer to select a non-standard (not openfaas-fn)
namespace from the UI to deploy a function into.

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-11-25 11:11:48 +00:00
Alistair Hey
dd0608d36c Add Namespace Dropdown to Gateway UI
This PR adds a namespace dropdown for the openfaas
namespaces. If a user has non-default namespaces
installed then a user can select that namespace,
view functions in that namespace, invoke them from
the UI and delete them from that namespace.

Signed-off-by: Alistair Hey <alistair@heyal.co.uk>
2019-11-25 11:11:48 +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)
040819b41c Bump faas-provider to 0.12.0
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-10-19 10:51:24 +01:00
Karthick Prabu
1c9e122370 Updated basic auth plugin faas provider
Signed-off-by: Karthick Prabu <karthikprabu.cs@gmail.com>
2019-10-15 22:25:26 +01:00