IngressPerAppRequirer: retry when IP is not available #426
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.
Issue
We recently encountered a production failure where the ingress requirer temporarily failed to retrieve unit IP information from Juju. As a result, the IP field in the ingress per-app integration unit data bag was missing, causing the ingress provider to fail in generating ingress resources for the ingress requirer. The investigation revealed that the ingress charm library does not attempt to retry retrieving IP information from Juju after the initial failure, thereby preventing the charm from automatically recovering from this situation.
Solution
There are several potential solutions to address this issue. For instance, the charm library could listen to all events and update the integration data on every event, or the charm could defer the integration event when IP retrieval fails, allowing it to retry in the next event. The defer solution appears to require the least modification and is the least invasive option.
Context
Testing Instructions
Unit tests and scenario tests have been updated to validate this new behavior.
Upgrade Notes
Charms that invoke the
provide_ingress_requirements
method might encounter an exception when IP information is unavailable from Juju due to the current implementation. However, charms using the implicit ingress requirements provisioning will not experience any exceptions.