Use POD_ADDRESS_RANGE for Dovecot if it exists #448
Merged
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.
This is required to override allow_nets in the Dovecot passdb query. In a Kubernetes environment where pods are not recreated with the same IP address, restricting to FRONT_ADDRESS and WEBMAIL_ADDRESS only works as long as the front and webmail pod don't die. Once they die, the query no longer is valid as their IP addresses have changed.
This solves the problem by allowing a POD_ADDRESS_RANGE environment variable in Dovecot which can be defined as a subnet (10.0.0.0/12 for example) that encompasses any possible IP address a pod may receive. If POD_ADDRESS_RANGE is not defined, previous behavior to use FRONT_ADDRESS and WEBMAIL_ADDRESS continues.
If its helpful for testing, an image is pushed to Docker hub romracer/mailu-dovecot:master with this change. I am currently using that version of this container in a Kubernetes setup.