Skip to content

Set up watchable to communicate between components#193

Merged
arkodg merged 6 commits intoenvoyproxy:mainfrom
danehans:luke_watchable_fix
Aug 5, 2022
Merged

Set up watchable to communicate between components#193
arkodg merged 6 commits intoenvoyproxy:mainfrom
danehans:luke_watchable_fix

Conversation

@danehans
Copy link
Copy Markdown
Contributor

@danehans danehans commented Aug 3, 2022

This PR pulls in https://github.com/telepresenceio/watchable/ to use for communication between components. This is PR #191 from @LukeShu with a commit to fix the failing Kube provider test.

Fixes: #34
Fixes: #38

LukeShu and others added 6 commits August 3, 2022 11:24
Signed-off-by: Luke Shumaker <[email protected]>
So I notice that I forgot to set the env-var when running the server
manually.

Signed-off-by: Luke Shumaker <[email protected]>
@danehans danehans requested a review from a team as a code owner August 3, 2022 21:03
@danehans danehans added this to the 0.2.0-rc1 milestone Aug 3, 2022
@danehans danehans added the area/message-service Issues related to Gateway's message service used for communication among components. label Aug 3, 2022
"name", request.Name)
// TODO: Delete gateway from the IR.
// xref: https://github.com/envoyproxy/gateway/issues/38
for namespacedName := range r.resourceTable.Gateways.LoadAll() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why are we deleting all the gateways here instead of just the one thats missing a valid gateway class ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the idea is that if there's no GatewayClass with a matching controller string that has a condition of "Accepted: true", then we should not be programming anything, therefore, we need to ensure all Gateways have been removed from the resource table.

Namespace: acceptedGateways[i].GetNamespace(),
}
r.resourceTable.Gateways.Store(key, &acceptedGateways[i])
if key == request.NamespacedName {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

wouldn't it be easier to reset r.resourceTable.Gateways and fill it up based on the contents of acceptedGateways ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, let's fix in a follow-up PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree with ^^, that should also better handle the case where the accepted GatewayClass changes (i.e. there used to be gc-1 and gc-2, with gc-1 being accepted, and then gc-1 gets deleted, now we should be processing gc-2) and we now need to remove all the Gateways for the old GatewayClass, and add the new ones.

Copy link
Copy Markdown
Contributor

@skriss skriss left a comment

Choose a reason for hiding this comment

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

The basic structure LGTM, I did have some comments on the logic within the gatewayclass and gateway controllers, but if you want to get this in to get the structure established and then follow up on the exact insertion/deletion logic, that's fine w me.

"name", request.Name)
// TODO: Delete gateway from the IR.
// xref: https://github.com/envoyproxy/gateway/issues/38
for namespacedName := range r.resourceTable.Gateways.LoadAll() {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the idea is that if there's no GatewayClass with a matching controller string that has a condition of "Accepted: true", then we should not be programming anything, therefore, we need to ensure all Gateways have been removed from the resource table.

Namespace: acceptedGateways[i].GetNamespace(),
}
r.resourceTable.Gateways.Store(key, &acceptedGateways[i])
if key == request.NamespacedName {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Agree with ^^, that should also better handle the case where the accepted GatewayClass changes (i.e. there used to be gc-1 and gc-2, with gc-1 being accepted, and then gc-1 gets deleted, now we should be processing gc-2) and we now need to remove all the Gateways for the old GatewayClass, and add the new ones.

}

updater := func(gc *gwapiv1b1.GatewayClass, accepted bool) error {
r.resourceTable.GatewayClasses.Store(gc.GetName(), gc)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Here I think we need to store the GC that is "Accepted: true", and remove all the other GCs with a matching controller that are "Accepted: false".

Note from past experience implementing this -- think about what happens if you have multiple GatewayClasses matching the controller string, and then the one that's currently "Accepted: true" gets deleted. Now we need to mark a new GatewayClass as "Accepted: true" (even though it itself has not changed or triggered a reconcile), and then also ensure all of the old GatewayClass's Gateways are removed from our internal model, and all of the Gateways for the new GatewayClass get added (even though the Gateways themselves may not have changed so are not triggering reconciles).

@arkodg
Copy link
Copy Markdown
Contributor

arkodg commented Aug 5, 2022

merged this one to unblock other PRs, hoping the comments can be address in follow up PRs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/message-service Issues related to Gateway's message service used for communication among components.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Initial Resource Translator Design and Implementation Initial Message Service Design and Implementation

5 participants