Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proxy readiness and make logs messages consistent #146

Merged
merged 5 commits into from
Oct 14, 2022

Conversation

alexellis
Copy link
Member

@alexellis alexellis commented Oct 14, 2022

Description

Proxy readiness and make logs messages consistent

Motivation and Context

Closes #145 - removing the need for additional methods in the faas-middleware package, and fixing an underlying bug in the way the readiness endpoint was called in one of the handlers. These other handlers also printed out log messages when using the readiness proxying, so that's been changed, so that it only happens when the User-Agent is not from Kubernetes.

Also: Makes the response messages consistent between HTTP, streaming and serializing modes.

How Has This Been Tested?

Tested with various processes as a Go process on a Linux host.

Including the unit testing added by Lucas in the reviewed PR.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

The log format is changed, if users are relying on parsing this, they can stay on an older version until they can migrate.

However all OF templates use either classic-watchdog or HTTP mode.

LucasRoesler and others added 5 commits October 10, 2022 14:50
Allow setting an endpoint path for the function readiness check via an
ENV variable `function_ready_endpoint`

When this value is set, the requests to `/_/ready` will execute an empty
GET request with/to the configured endpoint. This allows the function
authors to implement custom readiness check logic.

This custom request is checked _after_ the the standard liviness checks
and the ConcurrencyLimiter check. For a completely custom readiness
check, the function should be deployed with `max_inflight == 0` and
`function_ready_endpoint` to the custom path.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
When proxying the readiness request to the upstream function, we should
copy the original request headers. This allows the handler to use
headers, if needed. It also allows the of-watchdog to suppress the noisy
request logging for readiness checks.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
User read_path instead of function_ready_endpoint. This should be
clearer that it needs to be a path on the function and match prior art
in other projects.

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
Document why we use the base function handler to provide custom ready
checks to all function modes. Additionally, make sure that the unwrapped
function handler is passed to the readiness check. This ensures that
readiness checks do not count toward the concurrency limit

Review by AE - reverts change to faas-middleware, by introducing an
interface.

Closes: #145

Signed-off-by: Lucas Roesler <roesler.lucas@gmail.com>
Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
Makes the response messages consistent between HTTP,
streaming and serializing modes.

Tested with various processes as a Go process on a Linux host.

Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
@alexellis alexellis merged commit aa898b7 into master Oct 14, 2022
@alexellis alexellis deleted the openfaasltd/proxy-readiness branch October 14, 2022 12:17
@kevin-lindsay-1
Copy link

Based on the description, this sounds like it may also close #144.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants