⚠️ This PR brings a breaking change to the
[flagd-core](https://pkg.go.dev/github.com/open-feature/flagd/core)
library: the `IStore` interface now returns an additional value
representing the flag set metadata. There are no breaking changes in
flagd's behavior.
Changes in flagd:
- returns flag set metadata as metadata for error flags (best effort)
- returns flag set metadata in OFREP and RPC calls
- moves metadata merging logic to evaluator (all flags inherent flag set
metadata, but can override, as as before but now reusable in flagd core)
- removes duplicated flag set metadata keys when the same flag set
metadata key exists in multiple sources
### To Test
- requires `curl`, `grpcurl`, and `jq`
#### RPC
```shell
grpcurl -import-path /...../schemas/protobuf/flagd/evaluation/v1 -proto evaluation.proto -plaintext localhost:8013 flagd.evaluation.v1.Service/ResolveAll | jq
```
### OFREP
```shell
curl --location 'http://localhost:8016/ofrep/v1/evaluate/flags' --header 'Content-Type: application/json' --data '{"context": {"color": "yellow"}}' | jq
```
### Sync
```shell
grpcurl -import-path /...../schemas/protobuf/flagd/sync/v1/ -proto sync.proto -plaintext localhost:8015 flagd.sync.v1.FlagSyncService/FetchAllFlags | jq -r .flagConfiguration | jq
```
---------
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
- Mapped the error codes to easier to read error messages
- Created unit test to check functionality
#1100
---------
Signed-off-by: DBlanchard88 <davidblanchard88@gmail.com>
Signed-off-by: Dave <89858058+DBlanchard88@users.noreply.github.com>
Co-authored-by: Todd Baert <todd.baert@dynatrace.com>
## This PR
This change address
https://github.com/open-feature/open-feature-operator/issues/664.
**Background**
We allow using multiple flag source CRDs when using flagd-proxy with
OFO. Internally, this converts to flagd using gRPC syncs with scopes,
where scopes specify the CRD names that need to source flags from.
**Bug**
We had two bugs, first gRPC resyncs never contained `scope`. This is why
we observed `unable to build sync from URI for target` message.
Secondly, we triggered resyncs only considering source equility. This is
not valid with flagd-proxy as we always go through the proxy for any
CRD.
**Fix**
Fix here adds scope to gRPC resyncs and considers both source and
selector equality when triggering a resync
**How to validate the fix**
[Use this
image](https://hub.docker.com/repository/docker/kavindudodanduwa/flagd/general)
with OFO sidecar image override
```helm upgrade --install openfeature openfeature/open-feature-operator --set sidecarConfiguration.image.tag=1,sidecarConfiguration.image.repository=kavindudodanduwa/flagd```
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
## This PR
Fixes#1245 and introduce OFREP support for flagd
OFREP service runs on 8016 by default and can simply use curl for flag
evaluations,
```shell
curl -X POST 'http://localhost:8016/ofrep/v1/evaluate/flags/myBoolFlag'
```
NOTE - This PR touch several files as I had to migrate from
`github.com/golang/mock/gomock` to `go.uber.org/mock/gomock`. This is
because https://github.com/golang/mock is no longer maintained.
---------
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Signed-off-by: Kavindu Dodanduwa <Kavindu-Dodan@users.noreply.github.com>
Co-authored-by: Giovanni Liva <giovanni.liva@dynatrace.com>
Co-authored-by: Florian Bacher <florian.bacher@dynatrace.com>
<!-- Please use this template for your pull request. -->
<!-- Please use the sections that you need and delete other sections -->
## This PR
<!-- add the description of the PR here -->
- adds this new feature
### Related Issues
<!-- add here the GitHub issue that this PR resolves if applicable -->
https://github.com/open-feature/flagd/issues/435https://github.com/open-feature/flagd/issues/480https://github.com/open-feature/flagd/issues/481
### Notes
<!-- any additional notes for this PR -->
### Follow-up Tasks
<!-- anything that is related to this PR but not done here should be
noted under this section -->
<!-- if there is a need for a new issue, please link it here -->
### How to test
<!-- if applicable, add testing instructions under this section -->
---------
Signed-off-by: James Milligan <james@omnant.co.uk>