30 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)
2a88b5d2f7 Remove ioutil usage
This has been deprecated in Go for some time, in favour of the
io package.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
2023-08-22 18:29:28 +01:00
Lucas Roesler
06ade37420 feat: refactor api spec to use OpenAPI and add missing spec
Convert the existing swagger2.0 file to a moden OpenAPI file.
Add missing endpoitns and model definitions.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
2023-06-28 08:33:03 +01:00
Alex Ellis (OpenFaaS Ltd)
8e1c34e222 Set default max scale to 5 replicas and a 10% increment
Sets a new default maximum scale limit of 5 replicas out of
the box for CE users, CE meaning "Community" rather than
"Commercial".

The increment factor of 10 vs 25 should not make a difference
to genuine community and hobbyist users.

Tested and verified with unit tests and hey with a CE cluster
where the maximum limit was reached over several minutes,
finally going back to 1 replica.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2023-01-17 21:16:32 +00: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)
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)
df4126d8f5 Scale functions with namespace option
Allows alerts to trigger functions to scale when they
also have an optional namespace set.

Tested e2e with Kubernetes 1.15 and a non-default namespace.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
2019-09-20 18:38:55 +01:00
Gede Wahyu
3bdb194e71 Round up value of newReplicas
Signed-off-by: Gede Wahyu <tokekbesi@gmail.com>
2018-12-29 19:31:04 +00:00
Gede Wahyu
191629151e Remove the differentiation between currentReplicas==1 and not
Signed-off-by: Gede Wahyu <tokekbesi@gmail.com>
2018-12-29 19:31:04 +00:00
Alex Ellis (VMware)
9cea08c728 Extract scaling from zero
- extracting this package means it can be used in other components
such as the asynchronous nats-queue-worker which may need to
invoke functions which are scaled down to zero replicas.

Ref: https://github.com/openfaas/nats-queue-worker/issues/32

Tested on Docker Swarm for scaling up, already scaled and not
found error.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-11-01 15:10:08 +00:00
Alex Ellis (VMware)
f5939c9a60 Update for scaling edge-case
- as reported on Slack and in issue #931 the gateway scaling code
was scaling to zero replicas as a result of the "proportional
scaling" added by @Templum's PR. This commit added a failing test
which was fixed by adding boundary checking - now if the scaling
amount is "0" we keep the current amount of replicas.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-10-25 11:47:47 +01: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)
811bbe6031 Apply gofmt
Previous PR from Simon or Ken broke build due to missing gofmt
in the PR. This PR applies it to resolve the build issue.

Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
2018-04-11 20:46:20 -07:00
Simon Pelczer
7fe67d7af6 Implemented the autoscaling steps to be proportions of the max replicas.
Introduced an new label to set the scaling factor that is used to calculate th proportions, setting it to 0 also allows to disable scaling.
Updated the tests to reflect the changes and added a new test which shows that setting the scaling factor to 0 indeed does disable scaling.
Ensured that the scaling factor is always between [0 and 100].

Signed-off-by: Simon Pelczer <templum.dev@gmail.com>
2018-04-11 19:30:43 -07:00
Alex Ellis
30928739ee Use context for upstream timeouts
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-03-05 12:49:25 +00:00
Alex Ellis
f954bf0733 Merge master into breakout_swarm
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2018-02-01 09:29:54 +00:00
Alex Ellis
23a7187435 Refactoring: variable names, adding tests and http constants
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-12-05 06:50:08 -06:00
Alex Ellis
2452fdea0b Allow min-scale
Signed-off-by: Alex Ellis <alexellis2@gmail.com>
2017-12-05 06:50:08 -06:00
John McCabe
89878f0c8a Migrate from alexellis org to openfaas
Note, not all `alexellis/github` references should be changed, there are
a number of repos which are not part of the openfaas org, this commit
excludes those.

Signed-off-by: John McCabe <john@johnmccabe.net>
2017-10-04 09:18:06 +01:00
Alex Ellis
f165ce2ca7 External replica proxy 2017-08-08 09:14:46 +01:00
Alex
1e4b5f907a Wrap scaling / alert handling in interface/adapter pattern. 2017-08-08 09:14:46 +01:00
Alex
569ccbf323 Add license into code files for MIT 2017-04-27 23:21:50 +01:00
Alex Ellis
09cc91108a Enable handling of multiple concurrent alerts 2017-04-13 17:38:30 +01:00
Alex Ellis
c62c00e411 Fix for Docker upstream 2017-04-11 21:22:37 +01:00
Alex Ellis
4a0c712c0f Extract magic variables 2017-04-08 10:03:16 +01:00
Alex Ellis
a71329de4a Provide override for replica scaling to cap out at custom value. 2017-04-08 10:03:16 +01:00
Alex Ellis
2aeadfda1c Disable KeepAlive on proxy (#21)
* Service lookup

* Disable KeepAlive to force RR for replias.

* set KeepAlive to 0

* Remove temporary file

* Support white and rename function

* Remove debug from node sample
2017-03-21 08:39:36 +00:00
Alex Ellis
9f2183f6f3 Update test names 2017-02-21 19:09:11 +00:00
Alex
c211ba0d07 Cover replica scaling with tests. 2017-01-30 21:16:54 +00:00
Alex Ellis
501e813d41 Move handlers into ./handlers 2017-01-25 22:29:17 +00:00