Skip to content

Commit

Permalink
feat: added custom grpc resolver (#587)
Browse files Browse the repository at this point in the history
Signed-off-by: Pradeep <[email protected]>
  • Loading branch information
pradeepbbl authored Oct 29, 2024
1 parent 51238a0 commit e509afa
Show file tree
Hide file tree
Showing 9 changed files with 253 additions and 1,196 deletions.
15 changes: 15 additions & 0 deletions providers/flagd/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ Configuration can be provided as constructor options or as environment variables
|----------------------------------------------------------|--------------------------------|-----------------------------|-----------|---------------------|
| WithHost | FLAGD_HOST | string | localhost | rpc & in-process |
| WithPort | FLAGD_PORT | number | 8013 | rpc & in-process |
| WithTargetUri | FLAGD_TARGET_URI | string | "" | in-process |
| WithTLS | FLAGD_TLS | boolean | false | rpc & in-process |
| WithSocketPath | FLAGD_SOCKET_PATH | string | "" | rpc & in-process |
| WithCertificatePath | FLAGD_SERVER_CERT_PATH | string | "" | rpc & in-process |
Expand Down Expand Up @@ -100,6 +101,20 @@ On invocation of a flag evaluation (if caching is available) an attempt is made
By default, the provider is configured to use LRU caching with up to 1000 entries.
This can be changed through constructor option or environment variable `FLAGD_MAX_CACHE_SIZE`

### Target URI Support (gRPC name resolution)

The `TargetUri` is meant for gRPC custom name resolution (default is `dns`), this allows users to use different
resolution method e.g. `xds`. Currently, we are supporting all [core resolver](https://grpc.io/docs/guides/custom-name-resolution/)
and one custom resolver for `envoy` proxy resolution. For more details, please refer the
[RFC](https://github.com/open-feature/flagd/blob/main/docs/reference/specifications/proposal/rfc-grpc-custom-name-resolver.md) document.

```go
openfeature.SetProvider(flagd.NewProvider(
flagd.WithInProcessResolver(),
flagd.WithTargetUri("envoy://localhost:9211/test.service"),
))
```

## Supported Events

The flagd provider emits `PROVIDER_READY`, `PROVIDER_ERROR` and `PROVIDER_CONFIGURATION_CHANGED` events.
Expand Down
47 changes: 24 additions & 23 deletions providers/flagd/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,32 @@ toolchain go1.22.3

require (
buf.build/gen/go/open-feature/flagd/connectrpc/go v1.17.0-20240906125204-0a6a901b42e8.1
buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240215170432-1e611e2999cc.1
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.34.2-20240906125204-0a6a901b42e8.2
buf.build/gen/go/open-feature/flagd/grpc/go v1.5.1-20240906125204-0a6a901b42e8.1
buf.build/gen/go/open-feature/flagd/protocolbuffers/go v1.35.1-20240906125204-0a6a901b42e8.1
connectrpc.com/connect v1.17.0
connectrpc.com/otelconnect v0.7.1
github.com/cucumber/godog v0.14.1
github.com/go-logr/logr v1.4.1
github.com/go-logr/logr v1.4.2
github.com/google/go-cmp v0.6.0
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/open-feature/flagd/core v0.9.1
github.com/open-feature/flagd/core v0.10.4
github.com/open-feature/go-sdk v1.11.0
github.com/open-feature/go-sdk-contrib/tests/flagd v1.4.1
go.uber.org/mock v0.4.0
golang.org/x/exp v0.0.0-20240416160154-fe59bbe5cc7f
golang.org/x/net v0.26.0
google.golang.org/grpc v1.64.1
google.golang.org/protobuf v1.34.2
sigs.k8s.io/controller-runtime v0.17.3
go.uber.org/mock v0.5.0
golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842
golang.org/x/net v0.30.0
google.golang.org/grpc v1.67.1
google.golang.org/protobuf v1.35.1
sigs.k8s.io/controller-runtime v0.19.0
)

require (
github.com/barkimedes/go-deepcopy v0.0.0-20220514131651-17c30cfc62df // indirect
github.com/cucumber/gherkin/go/v26 v26.2.0 // indirect
github.com/cucumber/messages/go/v21 v21.0.1 // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.5.2 // indirect
github.com/diegoholiveira/jsonlogic/v3 v3.5.3 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-logr/zapr v1.3.0 // indirect
github.com/gofrs/uuid v4.3.1+incompatible // indirect
Expand All @@ -43,29 +44,29 @@ require (
github.com/klauspost/cpuid/v2 v2.2.7 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/open-feature/flagd-schemas v0.2.9-0.20240408192555-ea4f119d2bd7 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/open-feature/flagd-schemas v0.2.9-0.20240708163558-2aa89b314322 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/twmb/murmur3 v1.1.8 // indirect
github.com/x448/float16 v0.8.4 // indirect
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
github.com/xeipuuv/gojsonschema v1.2.0 // indirect
github.com/zeebo/xxh3 v1.0.2 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/otel v1.31.0 // indirect
go.opentelemetry.io/otel/metric v1.31.0 // indirect
go.opentelemetry.io/otel/trace v1.31.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.27.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/sys v0.21.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240415180920-8c6c420018be // indirect
golang.org/x/mod v0.21.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/text v0.19.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20241007155032-5fefd90f89a9 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apimachinery v0.29.3 // indirect
k8s.io/klog/v2 v2.120.1 // indirect
k8s.io/utils v0.0.0-20240310230437-4693a0247e57 // indirect
k8s.io/apimachinery v0.31.1 // indirect
k8s.io/klog/v2 v2.130.1 // indirect
k8s.io/utils v0.0.0-20240711033017-18e509b52bc8 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)
Loading

0 comments on commit e509afa

Please sign in to comment.