Skip to content
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

Ui Service Dump Gateway Enhancements #8411

Merged
merged 10 commits into from
Sep 29, 2020
Merged

Ui Service Dump Gateway Enhancements #8411

merged 10 commits into from
Sep 29, 2020

Conversation

freddygv
Copy link
Contributor

@freddygv freddygv commented Jul 30, 2020

This PR adds some enhancements needed for additional UI functionality related to gateways:

  • ConnectedWithProxy and ConnectedWithGateway track whether a service is proxied by a gateway or Connect proxy.
  • GatewayConfig.AssociatedServiceCount tracks the number of service names associated with a gateway

The main change is that Internal.ServiceDump now returns a dump of the gateway-services table, and we join the information from both of those on the client side.

Backwards compatibility of the changes made to the return type of Internal.ServiceDump have been tested.

Remaining TODO:

  • Fix panic in TestHTTPAPI_MethodNotAllowed_OSS
  • Add state store test for DumpGatewayServices
  • Update Internal.ServiceDump RPC endpoint tests

@freddygv freddygv requested a review from crhino July 30, 2020 16:26
@crhino
Copy link
Contributor

crhino commented Jul 30, 2020

Overall, I do like this better than the way I dealt with it in my PR! 👍


reply.Index, reply.Nodes = index, nodes
if err := m.srv.filterACL(args.Token, reply); err != nil {
if err := m.srv.filterACL(args.Token, reply.Nodes); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@freddygv freddygv requested a review from crhino August 5, 2020 22:14
@crhino
Copy link
Contributor

crhino commented Aug 11, 2020

Should this line be updated to *structs.IndexedNodesWithGateways?

resp, ok := u.Result.(*structs.IndexedCheckServiceNodes)

I see tests passing locally, but I would have expected something to fail here. 🤔

@freddygv
Copy link
Contributor Author

@crhino that was certainly making integration tests fail, fixed.

@crhino
Copy link
Contributor

crhino commented Sep 23, 2020

Ah, merging #8704 caused conflicts with this, should be easy to rebase on top of master though.

Copy link
Contributor

@crhino crhino left a comment

Choose a reason for hiding this comment

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

LGTM, with one comment about confusing output in the two API endpoints that use summarizeService. That shouldn't matter for the usage we have in mind now, but is something to think about in the future/when refactoring.

@@ -199,18 +200,22 @@ RPC:
return nil, err
}

return summarizeServices(out.Dump, s.agent.config), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

The more /v1/internal/ui/gateway-services-nodes/<name> and /v1/internal/ui/services diverge, the more awkward it feels using summarizeServices to account for both. I got confused because I was accidentally testing out /v1/internal/ui/gateway-services-nodes/gateway-name and ConnectedWithGateway/ConnectedWithProxy were false for services that did have proxies and gateways. Eventually I realized that endpoint does not pass in a list of gateways here, which accounts for that difference. Definitely feels a bit weird though.

Perhaps we can put a TODO here about refactoring this to make the two endpoints more separate? Or somehow cleaning up the confusion of the output?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm about to add a 3rd summary use-case in another PR 🙈 .

I'll address it there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants