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

ADR-92 & AP-19: BFF proposal #99

Merged
merged 16 commits into from
Apr 17, 2023

Conversation

andreaTP
Copy link
Contributor

Opening this PR as Draft to foster collaboration on the Proposal itself and for early comments.

cc. @EricWittmann @riccardo-forina @MikeEdgar @dimakis @lburgazzoli

@andreaTP andreaTP changed the title WIP BFF proposal [WIP] BFF proposal Mar 14, 2023
@andreaTP
Copy link
Contributor Author

Question for @tombentley and @emmanuelbernard , I got again confused regarding AP vs. ADR 😢
@tombentley booked it as AP but:

  • it doesn't automatically apply to specific situations and highly depends on the current system setup and capabilities
  • it's not a generic solution or pattern as it highly depends on the design(accidental or deliberate) of the rest of the system
  • I do not want to "sell BFF" as a general solution as, almost everything here, is based on tradeoffs

I ended up framing it as an ADR, let me know if this works for you.

@emmanuelbernard
Copy link
Contributor

If you feel BFF should not be used for other services like RHOC or whatever is coming up, then it is the right choice. I had a different impression in our conversation last Wed.

@andreaTP
Copy link
Contributor Author

If you feel BFF should not be used for other services like RHOC or whatever is coming up, then it is the right choice. I had a different impression in our conversation last Wed.

I haven't analyzed the current situation in RHOC to be able to answer your question 😢 , let me gather @lburgazzoli feedback to address this.
If we reach an agreement I'll bundle this ADR up with an AP.

@emmanuelbernard
Copy link
Contributor

If we reach an agreement I'll bundle this ADR up with an AP.

Not bundle, since AP have a different intent and template, it's a partial rework.


The integration of the Enterprise/Hybrid option of RHOSAK in UI, SDKs and CLI has shown that there is a margin for improvement in how we expose and consume our services APIs.

* the current services are offering the bare functionality leaving room for integration code to live in the services' consumer codebases

Choose a reason for hiding this comment

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

I'm not sure I understand this 100%. Can you explain a bit more what you mean and maybe we can reword a bit to be more clear?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tentatively:

the services are exposing APIs for the offered specific functionality, but we lack an integration layer

what we are trying to say is that there is no integration logic exposed by the current services.
The services are offering APIs modeled after their specific functionality and are very vertical, but any operation that involves more than one service becomes difficult and involves writing the integration logic on the client side.

Feel free to propose a better working 🙏 !

* the current services are offering the bare functionality leaving room for integration code to live in the services' consumer codebases
* the data aggregation logic is duplicated, scattered, and eventually diverging in various codebases (especially UI and CLI)
* there is no "single source of truth" for data aggregated from various services
* the current REST API layer exposes the user to the entire complexity of the underlying infrastructure

Choose a reason for hiding this comment

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

Is it the complexity of the infrastructure that's exposed or is it the complexity of the main service PLUS the supporting services (e.g. AMS)? Infrastructure makes me think we're exposing network routing and whatnot. That may be true for RHOSAK Enterprise maybe?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Renaming infrastructure -> architecture.
We do not expose (much)"infrastructure" detail, but the user really needs to know the architecture of the system to navigate it.

_adr/92/index.adoc Outdated Show resolved Hide resolved
@EricWittmann
Copy link

Added some comments but looks good overall. Something that's missing perhaps is a comment about potential lack of control (not now I guess but maybe in the future) over APIs being aggregated. Another benefit of the BFF approach is when we are running a service using e.g. an Apache project, we might not be able to modify the API to make it more suitable for use by the UI/CLI (something you could argue we can mostly do today).

@andreaTP
Copy link
Contributor Author

Thanks, @EricWittmann for the review!
I attempted to address your points, I believe that your last comment on "OSS projects APIs" is covered by the current wording in "Goals", feel free to suggest an improvement there though!

@lburgazzoli
Copy link

If you feel BFF should not be used for other services like RHOC or whatever is coming up, then it is the right choice. I had a different impression in our conversation last Wed.

I haven't analyzed the current situation in RHOC to be able to answer your question cry , let me gather @lburgazzoli feedback to address this. If we reach an agreement I'll bundle this ADR up with an AP.

For RHOC things are exacerbates by the fact that we must interact with multiple services, i.e. Kafka & Service Registry so we would benefit from a BFF that knows how to interact with such services (i.e. to set-up/check permissions, gather additional information, etc).

@andreaTP
Copy link
Contributor Author

Added the AP proposal, marking as Ready For Review now

@andreaTP andreaTP marked this pull request as ready for review March 20, 2023 10:54
@andreaTP andreaTP changed the title [WIP] BFF proposal BFF proposal Mar 20, 2023
@riccardo-forina
Copy link

Could we also try to solve the subscription problem as well? We use the polling pattern now to get the data we need when it changes, but it's not the cleanest solution as it unnecessarily requires a lot of micromanagement and hammers the backend.

@gashcrumb
Copy link

gashcrumb commented Mar 20, 2023

I'd suggest just a BFF isn't enough. I think offloading client-specific concerns such as handling update subscriptions and caching is great and we should adopt a BFF for those reasons to support each client-side experience.

But I'd also suggest we probably need a separate business integration service that handles the orchestration of the service APIs and it needs to be adaptable to changing business concerns, kind of the two things we currently try and spread between our UI and API a bit.

@andreaTP
Copy link
Contributor Author

we probably need a separate business integration service that handles the orchestration of the service APIs and it needs to be adaptable to changing business concerns

@gashcrumb this proposal is exclusively targeting the BFF as an architectural component to respond to the current concerns in development.
Feel free to go ahead and issue a follow-up ADR/AP to further modularize and separate the concerns of the BFF.
More specifically I do not intend to increase the scope of this proposal for the following reasons:

  • developing and (especially)running a component is a significant team effort, doubling from the start makes it more challenging to get something done
  • we have already been questioned about public API support and APIs proliferation, those are concerns that we should be seriously re-considered when proposing an additional component
  • early optimization, I would like to see the BFF in place and re-evaluate the situation other than separating concerns in the first place
  • risk management, going live with one new service instead of two improves the situation by limiting the unknowns and having more predictable timelines

That said I'm supportive of reconsidering your proposal after the first version of the BFF is in place 👍

@andreaTP
Copy link
Contributor Author

andreaTP commented Mar 21, 2023

@tombentley I moved this PR from Draft to Ready for Review do you mind adding the @bf2fc6cc711aee1a0c2a/service-leads as the list of reviewers?
thanks in advance 🙏

@tombentley tombentley changed the title BFF proposal ADR-92 & AP-19: BFF proposal Mar 21, 2023
_adr/92/index.adoc Outdated Show resolved Hide resolved
_adr/92/index.adoc Outdated Show resolved Hide resolved
_adr/92/index.adoc Outdated Show resolved Hide resolved
_adr/92/index.adoc Outdated Show resolved Hide resolved
_adr/92/index.adoc Show resolved Hide resolved
andreaTP and others added 2 commits March 29, 2023 13:46
Co-authored-by: Aurélien Pupier <apupier@redhat.com>
Copy link

@EricWittmann EricWittmann left a comment

Choose a reason for hiding this comment

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

LGTM

@andreaTP
Copy link
Contributor Author

We have gone through discussions and agreements on all of the open points.
I now need a review from all of the @bf2fc6cc711aee1a0c2a/service-leads 🙏

_adr/92/index.adoc Outdated Show resolved Hide resolved
_ap/19/index.adoc Show resolved Hide resolved
@andreaTP
Copy link
Contributor Author

andreaTP commented Apr 3, 2023

A polite ping to @danielezonca @maleck13 @tombentley @lburgazzoli for the review! Thanks in advance 🙏

Copy link

@maleck13 maleck13 left a comment

Choose a reason for hiding this comment

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

A concern I have here is called out as a challenge, it does not work for private data planes, which could restrict the potential customer / user base and whether that is something that is an acceptable tradeoff.

@andreaTP
Copy link
Contributor Author

andreaTP commented Apr 4, 2023

it does not work for private data planes

@maleck13 thanks a lot for the review! I do believe that we have full freedom to move this component to the data plane when/if necessary.
We marked it as an open point as it depends on other architectural changes and proposals that are being discussed those days.
Does this and Riccardo's answer your question?

@maleck13
Copy link

maleck13 commented Apr 4, 2023

Yes the answers helped thanks

Copy link
Contributor

@danielezonca danielezonca left a comment

Choose a reason for hiding this comment

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

A minor comment but LGTM 👍

_adr/92/index.adoc Outdated Show resolved Hide resolved
[NOTE]
*Assumption* as a first iteration we are assuming that the CLI needs can be covered by a strict subset of the functionalities needed for the UI.

We propose to integrate *one* server side component commonly known as https://samnewman.io/patterns/architectural/bff/[BFF] (Backend For Frontend).
Copy link
Contributor

Choose a reason for hiding this comment

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

Just to make sure I understand the proposal: this proposal covers the use case where BFF is part of a "single service" in terms of ownership/SLO (like KAS) so this is an additional endpoint is going to be part of the API delivered by that specific service.
So if a feature can be reused (i.e. some common pattern to create SA and grant access to topic) or involves multiple services (with different CP) the endpoint is going to be "assigned" to one service (or duplicated?) that is going to own this new component.

If "cross service BFF" is not covered, I would probably add this to the "Non-goals" section.
Wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so this is an additional endpoint is going to be part of the API delivered by that specific service.

this is not correct, here we are proposing BFF as a separate service with a new spec that is going to aggregate multiple different services.
We are somehow covering only what you call "cross service BFF", as having one BFF associated with one service almost defeats the purpose of BFF (at least in this context).
Also, we are here proposing a single BFF service for the entire platform.

If this is not clear, please, point out the confusing sections and I will try to re-phrase 👍

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the clarification, fine for me to keep current phrasing 👍

Copy link

Choose a reason for hiding this comment

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

here proposing a single BFF service for the entire platform.

Define entire platform.

Copy link
Contributor

Choose a reason for hiding this comment

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

Entire platform means RHOSAK RHODS RHOC as I understand it

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we have enough context to include RHODS in the scope of this decision, I would "limit" the scope this ADR to RHOSAK+RHOC+RHOSR and postpone to a revision RHODS but also RHOAM and other services

Copy link
Contributor

Choose a reason for hiding this comment

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

From what I foresee, we won't have a choice if we want a good UX. So let's go with this bold intent and cast exclusions as we go.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see this as a very bold intent given that RHODS for example has the on-prem as a very important setup and also private cloud data plane configurations are not fully explored. :)

Btw I was mainly referring to the ADR that is "Kafka ecosystem" specific while the AP is probably generic enough and I agree that we aim to have a coherent UX across the whole portfolio so the problem statement and approach for the solution can be valid for every service

Co-authored-by: Daniele Zonca <dzonca@redhat.com>
@andreaTP
Copy link
Contributor Author

andreaTP commented Apr 5, 2023

@tombentley can you please, review or delegate the review of this PR? Thanks in advance 🙏

This change has two objectives:
1. Make the AP more concrete and clearer to teams that will read it in
   the future and the constraints it puts on them.
   In particular, limits and choices are detailed
2. Clarify that GraphQL was not chosen but keep the door open to a
   future use.
@emmanuelbernard
Copy link
Contributor

Hey @andreaTP @riccardo-forina and all,

In order to help move forward, I've sent a PR to your PR (not sure how well it will work).
andreaTP#1

I've closed some conversations in the ADR that were pending here.
I've also adjusted the AP to show what I was trying to convey and the choices that I think are important.
In particular, I want it to be closer to actionable than theoretical.

@emmanuelbernard
Copy link
Contributor

I tried to add commits to Andrea's own branch but without success, hence the PR

@tombentley
Copy link
Contributor

@andreaTP this was top of my todo list today, but do you want me to review this now, or once you've merged Emmanuel's PR into the branch for this PR?

emmanuelbernard and others added 2 commits April 6, 2023 12:28
Co-authored-by: Daniele Zonca <dzonca@redhat.com>
Bff proposal additional improvements
@andreaTP
Copy link
Contributor Author

andreaTP commented Apr 6, 2023

thanks @emmanuelbernard for the PR, merged 👍
@tombentley ready for review now

Copy link
Contributor

@tombentley tombentley left a comment

Choose a reason for hiding this comment

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

Thanks for your efforts on this @andreaTP and @riccardo-forina

_ap/19/index.adoc Outdated Show resolved Hide resolved
_ap/19/index.adoc Outdated Show resolved Hide resolved
andreaTP and others added 2 commits April 6, 2023 16:39
Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
Co-authored-by: Tom Bentley <tombentley@users.noreply.github.com>
@andreaTP
Copy link
Contributor Author

andreaTP commented Apr 6, 2023

Ready to merge AFAIU 🙏 thanks everyone for the input!

@tombentley tombentley merged commit 7d7be37 into bf2fc6cc711aee1a0c2a:main Apr 17, 2023
@andreaTP
Copy link
Contributor Author

🎉 🎉 🎉

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.