Use Desired Replicas when scaling from zero
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>
Showing
- gateway/Makefile 3 additions, 3 deletionsgateway/Makefile
- gateway/handlers/notifiers.go 1 addition, 1 deletiongateway/handlers/notifiers.go
- gateway/handlers/scaling.go 2 additions, 1 deletiongateway/handlers/scaling.go
- gateway/plugin/external.go 3 additions, 2 deletionsgateway/plugin/external.go
- gateway/scaling/function_scaler.go 55 additions, 32 deletionsgateway/scaling/function_scaler.go
Loading
Please register or sign in to comment