Repository navigation
Read the health check path from the configuration file - #46
Merged
Merged
Conversation
The upstream server registers every path of the comma separated path option
on its HTTP mux. Registering the same path twice makes the Go HTTP mux
panic, so the server stopped right after it was started:
panic: pattern "/dns-query" (registered at server.go:106) conflicts
with pattern "/dns-query" (registered at server.go:106)
This happened for every configuration where the primary path is the same
as one of the additional paths. With the default of DOH_HTTP_PREFIXES it
happened for every user that sets DOH_HTTP_PREFIX to /dns-query.
The entrypoint now skips a path that is already configured and the patch
for the upstream server skips a path that is already registered as well, so
a hand written configuration with a duplicated path does not panic either.
The test suite starts a container with the same path as the primary and the
additional path and asserts that it starts and answers queries.
Fixes #40
The health check requested the path from the DOH_HTTP_PREFIX variable, so it probed a path that does not exist when that variable was empty or contained whitespace. The container was then reported as unhealthy even though the server was running and answering queries. The health check is a small script now. It reads the path from the configuration file that is in use, which is the source of truth and works for a generated configuration as well as for a mounted one. When the configuration can not be read, any answer from the server is accepted. The script is installed with mode 0755, it is executed as the unprivileged user of the container and was not executable for it before. The test suite now checks a matrix of path configurations, every entry starts a container and asserts that it becomes healthy, that the configured paths answer and that an unknown path is not served. The matrix covers the paths of the helm chart and the example of the readme as well.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The health check requested the path from the
DOH_HTTP_PREFIXvariable, so it probed a path that does not exist when that variable was empty or contained whitespace. The container was then reported as unhealthy even though the server was running and answering queries.The health check is a small script now. It reads the path from the configuration file that is in use, which is the source of truth and works for a generated configuration as well as for a mounted one. When the configuration can not be read, any answer from the server is accepted.
The script is installed with mode 0755, it is executed as the unprivileged user of the container and was not executable for it before.
The test suite now checks a matrix of path configurations, every entry starts a container and asserts that it becomes healthy, that the configured paths answer and that an unknown path is not served. The matrix covers the paths of the helm chart and the example of the readme as well.