open-feature / flagd

A feature flag daemon with a Unix philosophy
https://openfeature.dev
Apache License 2.0
560 stars 64 forks source link

[FEATURE] Support serving sync.proto #1230

Closed toddbaert closed 8 months ago

toddbaert commented 8 months ago

Requirements

Problem

Currently, flagd doesn't support the flagd.sync.proto. This means that flagd cannot directly serve in-process providers. Users can still use in process providers by implementing a server that serves this proto, which is great if they are interested in building a custom control plane, perhaps with a UI. However, it's perfectly reasonable for users to want to use flagd itself with in-process providers.

Proposal

Support serving the flagd.sync.proto in flagd. When a sync client connects, it can use its selector field to select a source flagd is already watching (an http endpoint, file, or CR instance). If no selector is specified, the client will get a merged representation of all sources flagd is watching (using the same merge logic as flagd). Note that unlike the flagd proxy, dynamically watching additional sources would not be supported. The sync endpoint would run on a separate port from the evaluation endpoint.

Benefits

Tasks

Kavindu-Dodan commented 8 months ago

I will start working on this

toddbaert commented 8 months ago

I will start working on this

Amazing... let me know if you have any questions or want to meet up to think through anything.

One thing I'm so far not sure on is the use of connect... if it costs nothing, I'm fine with it... but if it's adds a lot of complexity we can re-evaluate cc @beeme1mr .

Kavindu-Dodan commented 8 months ago

Update - 01.03.2024

Kavindu-Dodan commented 8 months ago

Update - 04.03.2024

WIP PR #1237 for early builds. However, #1234 must be considered first and diff is huge as this is based on #1234

Kavindu-Dodan commented 8 months ago

After some deep dive, found out it would require client migrations if we wants to build this with connect support. This is because a connect server cannot work with a grpc client directly. This is highlighted at migration guide [1] as well as connect's solution to bridge the gap - vanguard-go [2]

So I will differ use connect protocol, so support both web and server clients (optional, but suggested) to another time

[1] - https://connectrpc.com/docs/go/grpc-compatibility#migration [2] - https://github.com/connectrpc/vanguard-go?tab=readme-ov-file#why-vanguard

toddbaert commented 8 months ago

After some deep dive, found out it would require client migrations if we wants to build this with connect support. This is because a connect server cannot work with a grpc client directly. This is highlighted at migration guide [1] as well as connect's solution to bridge the gap - vanguard-go [2]

So I will differ use connect protocol, so support both web and server clients (optional, but suggested) to another time

[1] - https://connectrpc.com/docs/go/grpc-compatibility#migration [2] - https://github.com/connectrpc/vanguard-go?tab=readme-ov-file#why-vanguard

I support this decision. Please just make it clear in any doc, etc. We COULD multiplex it in the future to even do it non breaking if we add it.

Kavindu-Dodan commented 8 months ago

After some deep dive, found out it would require client migrations if we wants to build this with connect support. This is because a connect server cannot work with a grpc client directly. This is highlighted at migration guide [1] as well as connect's solution to bridge the gap - vanguard-go [2] So I will differ use connect protocol, so support both web and server clients (optional, but suggested) to another time [1] - https://connectrpc.com/docs/go/grpc-compatibility#migration [2] - https://github.com/connectrpc/vanguard-go?tab=readme-ov-file#why-vanguard

I support this decision. Please just make it clear in any doc, etc. We COULD multiplex it in the future to even do it non breaking if we add it.

Agree, I have completed all other task goals with PR #1237