Closed jaydenrasmussen closed 6 months ago
After some further research I came across the following article which makes mention of adding faas-idler
to the faasd docker-compose yaml to enable this behavior. Is it expected for users to do this to enable scale to zero? Both the blog post and the official documentation make it seem like this is out of the box functionality.
Yes, you are correct. fasad is never supposed to support scaling functionality.
You can use openfass pro or community edition for further use case.
If that's the case then why does the /system/scale-function
endpoint exist?
Aah, my bad I mistook it for scaling across nodes. I will dig into it.
I've reproduced this. It was working in 16.5 (the version I already had available on a microvm) it isn't working with faasd version: 0.18.2 commit: 078043b168d8e18fa2671de9cc1f9aca27d4e9baa
To isolate the problem I would ignore faas-idler
for the time being - this would generate the request to the endpoint in the same way you are doing manually.
The gateway returns a 200:
Jan 07 09:32:55 faasd openfaas:gateway[6351]: 2024/01/07 09:32:55 Forwarded [GET] to /system/functions - [200] - 0.0349s
Jan 07 09:33:13 faasd openfaas:gateway[6351]: 2024/01/07 09:33:13 Forwarded [POST] to /system/scale-function/nodeinfo - [200] - 0.0173s
Jan 07 09:33:15 faasd openfaas:gateway[6351]: 2024/01/07 09:33:15 Forwarded [GET] to /system/functions - [200] - 0.0529s
Jan 07 09:36:02 faasd openfaas:gateway[6351]: 2024/01/07 09:36:02 Forwarded [POST] to /system/scale-function/nodeinfo - [200] - 0.0204s
System services deployed:
CONTAINER IMAGE RUNTIME
gateway ghcr.io/openfaas/gateway:0.27.2 io.containerd.runc.v2
nats docker.io/library/nats-streaming:0.25.5 io.containerd.runc.v2
prometheus docker.io/prom/prometheus:v2.47.0 io.containerd.runc.v2
queue-worker ghcr.io/openfaas/queue-worker:0.14.0 io.containerd.runc.v2
I have been trying to debug it in my local. Yes it's not working as expected.
Although, we are sending replicas as 0 in request body as shown in below curl request
curl -v -X POST http://$FAASD_USER:$FAASD_PASS@$FAASD_GATEWAY:8080/system/scale-function/env-store-test \ -d '{"serviceName":"env-store-test", "replicas": 0}'
But in faasd logs received request have replica is 1 as shown below
Feb 18 20:00:39 faasd-test faasd[7170]: 2024/02/18 20:00:39 [Scale] request: {"serviceName":"env-store-test","replicas":1}
Hi, scale to zero isn't supported for the Community Edition of OpenFaaS, a commercial license is required for OpenFaaS Standard, which for faasd, we offer at a significant discount per installation vs. the Kubernetes pricing.
faas-idler is a commercial feature of OpenFaaS Standard.
Alex
/set title: Is Scale to Zero included in the Community Edition of OpenFaaS?
Due diligence
My actions before raising this issue
Before you ask for help or support, make sure that you've consulted the manual for faasd. We can't answer questions that are already covered by the manual.
Why do you need this?
Scaling to/from zero is a documented use case for faasd
Who is this for?
What company is this for? Are you listed in the ADOPTERS.md file?
Expected Behaviour
Functions scale to zero, per this post and the manual. Example request should work (based on the swagger example)
The above linked post actually differs from the swagger doc included in the manual
serviceName
instead ofservice
.Current Behaviour
Making a request to the
scale-function/{functionName}
endpoint with a body containing"service"
fails with a 404. The same request using"serviceName"
in place of"service"
succeeds with 200 however will not scale a function below 1.List All Possible Solutions and Workarounds
To my knowledge there's not a workaround using faas-cli or the API. If the user has ssh access to the machine they could manually kill the task with
ctr
.Which Solution Do You Recommend?
faas-cli scale {functionName} 0
Steps to Reproduce (for bugs)
faas-cli store deploy nodeinfo
faas-cli list
Your Environment
OS and architecture: ubuntu 22.04.3 / amd64
Versions: