-
Notifications
You must be signed in to change notification settings - Fork 28
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
Refresh url on access #107
Conversation
7290099
to
30bdecc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
couple of food-for-thought points, but it looks good.
return None | ||
return self.urls.get(self.charm.unit.name) | ||
return urls.get(self.charm.unit.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do you just like this more, or is there a logic change I'm missing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we could use walrus then I'd use walrus.
It's to avoid fetching the urls property twice.
It mattered more before I refactored.
@@ -832,16 +831,16 @@ def urls(self) -> Dict[str, str]: | |||
|
|||
May return an empty dict if the URLs aren't available yet. | |||
""" | |||
data = _type_convert_stored(self._stored.current_urls or {}) # type: ignore |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we get rid of stored altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Currently it's used to compare current vs. previous for emitting the custom events.
Do you mean use peer data instead?
Issue
canonical/catalogue-k8s-operator#3
Solution
Refresh url on access (example) by pre-fetching urls from relation data instead of stored state.
Context
See thread: canonical/catalogue-k8s-operator#4 (comment)
Testing Instructions
Deploy the bundle and see which URL catalogue has for prom: fqdn or ingress.
Release Notes
Prefetch urls from reldata instead of stored state.