Return the original upstream response body when the the list request
returns an error. In general, the provider is returning useful and
actionable error messages for the user, the previous code hid this in
the logs and this is easy for user to overlook.
Additionally, remove an early return from error case after fetching
metrics. This looked like a bug and could result in empty api responses
if there was a prometheus error.
Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
We now have two write interceptors, with one moved into
faas-provider. This commit makes the gateway use the new
external package and deletes its own.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
During some exploratory testing, I ran into an issue where
the gateway would attempt to scale a deployment from zero
replicas to min, despite there already being min replicas.
Why?
The scaling logic was looking for Available replicas when
it should have looked for Desired replicas. So when a
deployment had zero ready replicas due to readiness checks
failing, the gateway was attempting to scale from zero
to min.
This logic has been corrected and separated from the
a holding pattern where the gateway waits for a ready
replica.
Tested with KinD and an edited function which had a
readiness probe, which was failing and no ready
replicas. As desired, the gateway did not scale to min.
However, when setting desired replicas to zero, the
gateway did scale up as expected.
This change also modifies all print statements for
"seconds" and makes them use 4 decimal places instead of
the default which was a longer, more verbose string for
the logs.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
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>
* 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>
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>
When querying for replicas during a scale up event, then the
gateway can overwhelm the provider with requests. This is
especially true under high concurrent load.
The changes in this PR limit the inflight requests.
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alex@openfaas.com>
👋
There was an extra newline character after the first entry in the `Interviews and podcasts` sections breaking the markdown preview. Corrected it.
Signed-off-by: Andreas Mosti <andreas.mosti@gmail.com>
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>