Skip to content
This repository has been archived by the owner on Apr 2, 2024. It is now read-only.

Supporting app level relation data #232

Merged
merged 18 commits into from
Nov 30, 2021
Merged

Supporting app level relation data #232

merged 18 commits into from
Nov 30, 2021

Conversation

xtrusia
Copy link
Contributor

@xtrusia xtrusia commented Feb 19, 2021

I need some advice to implement this.

Please review my code if it is proper or there is good way

Copy link
Contributor

@johnsca johnsca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comments and suggestions inline. Mostly this is just missing a way to read the app level data from the remote side, but there is an issue with the way the request / response pattern is currently implemented that doesn't quite work with how Juju handles app level data (the permission denied issue).

Edit: The permission denied issue would be a problem for the general case, but the prometheus-manual interface is the only interface layer that I know of using that set of classes and for that case, non-leaders don't need to see the response so it's not a concern. Just ensure that the charm wraps any usage of this in an is-leader check and it should be fine.

charms/reactive/endpoints.py Outdated Show resolved Hide resolved
charms/reactive/endpoints.py Outdated Show resolved Hide resolved
charms/reactive/endpoints.py Outdated Show resolved Hide resolved
charms/reactive/endpoints.py Outdated Show resolved Hide resolved
charms/reactive/patterns/request_response.py Outdated Show resolved Hide resolved
charms/reactive/patterns/request_response.py Outdated Show resolved Hide resolved
Copy link
Contributor

@johnsca johnsca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apologies for the long lag time between reviews on this. I should note that this library is deprecated in favor of the Operator Framework, so doesn't really have a dedicated team or engineering time allocated for anything other than patches / bug fixes, so landing larger changes like this is likely to be slow. Also, I am still not fully convinced that my suggestion on the specific bug regarding forcing the request ID won't work. But either way I created a card for myself to track this and will try to stay on top of it better going forward.

charms/reactive/patterns/request_response.py Outdated Show resolved Hide resolved
charms/reactive/patterns/request_response.py Outdated Show resolved Hide resolved
@johnsca
Copy link
Contributor

johnsca commented Jul 15, 2021

I was thinking about this more, and since I'm 95% certain that the Request / Response pattern from the library is only used in the one interface implementation, maybe it would make sense to just move that part of the code out to live directly in the interface library and pare this PR down to just adding the app-level relation data support to the base Endpoint class. That would make it significantly easier to land here and rev on the parts that the interface needs separately in that repo.

@xtrusia
Copy link
Contributor Author

xtrusia commented Sep 2, 2021

I was thinking about this more, and since I'm 95% certain that the Request / Response pattern from the library is only used in the one interface implementation, maybe it would make sense to just move that part of the code out to live directly in the interface library and pare this PR down to just adding the app-level relation data support to the base Endpoint class. That would make it significantly easier to land here and rev on the parts that the interface needs separately in that repo.

Hello

I think you meant I only need to submit for base Endpoint from previous commit and move request response changes to interface_prometheus_manual . so I removed code related to request_response. if there is anything I misunderstood, please correct me.

Thanks a lot

@xtrusia xtrusia requested a review from johnsca September 2, 2021 08:54
Copy link
Contributor

@johnsca johnsca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the streamlining of the PR and my fixes, I think this is GTG.

@@ -474,6 +474,7 @@ def set_state(self, state, scope=None):
See :meth:`conversation` and :meth:`Conversation.set_state`.
"""
self.conversation(scope).set_state(state)
set_flag = set_state
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The formatting looks really weird on this file; I think there should be newlines and perhaps a comment to indicate that set_flag is just aliasing set_state

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I missed that these are still in here. They're actually method aliases, but they should have been cleaned up with the rest of the streamlining of the PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, these changes come from #233. I'm not sure why they're showing up in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebased to resolve.

Copy link
Contributor

@ajkavanagh ajkavanagh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ajkavanagh ajkavanagh merged commit 92a8ee4 into juju-solutions:master Nov 30, 2021
@johnsca
Copy link
Contributor

johnsca commented Nov 30, 2021

Released in 1.5.0

@xtrusia xtrusia mentioned this pull request Mar 23, 2022
ajkavanagh pushed a commit that referenced this pull request Apr 25, 2022
Squashed commit notes:  Fixing a bug from [2].

* Fixing wrong reference
* remove 3.5 test

Driven by:

* relation_id is in Endpoint class, but self.relation. returns relation.so it should be self.relation_id instead of self.relation.relation_id
* LP[1] is the cause of this implementation. ( prior patch was : [2])

[1]: LP : https://bugs.launchpad.net/charm-kubernetes-master/+bug/1899706
[2]: #232
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants