flipt
flipt copied to clipboard
[Bug]: Rules aren't being linked correctly when importing features from a config file
Bug Description
When running flipt in a container, mounting in a feature+segment yaml creates all the correct flags and segments, but when queried with a context containing a property that should match a rule I get an error saying that a rule can't be found.
Am I misconfiguring flipt? We recently moved from manually created rules using a set of curl commands to wanting to be able to override commands when deploying using helm by mounting in a feature flag file but have run into this issue both when deployed to Kubernetes using helm, and also when just running with Docker.
Version Info
Running the latest tag of flipt in dockerhub, currently: Version: v1.41.1
Also tested with v1.30.1
and got the same issue.
Search
- [X] I searched for other open and closed issues before opening this
Steps to Reproduce
Create the two config files below and run the docker command:
docker run \
-p 8080:8080 \
-p 9000:9000 \
-v $HOME/Features.yaml:/etc/flipt/features/features.yaml \
-v $HOME/Config.yaml:/etc/flipt/config/default.yml \
docker.flipt.io/flipt/flipt:latest
Expected Behavior
Expect it to return a match if the email matches a rule for a flag, the same as how it does when you create the segments/rules manually -
Additional Context
Config.yaml:
storage:
type: local
local:
path: "/etc/flipt/features"
Features.yaml:
version: "1.2"
namespace: default
flags:
- key: test_key
name: test_key
type: VARIANT_FLAG_TYPE
description: A test key
enabled: true
rules:
- segment: test_segment
segments:
- key: test_segment
name: test_segment
constraints:
- type: STRING_COMPARISON_TYPE
property: email
operator: suffix
value: 'test.com'
match_type: ANY_MATCH_TYPE
Curl response of the rules associated with the mounted in flag, with a different rule ID than in the error screenshot:
curl http://localhost:8080/api/v1/namespaces/default/flags/test_key/rules
{"rules":[{"id":"869afeea-2b3b-437e-bf43-329e6e997389","flagKey":"test_key","segmentKey":"test_segment","distributions":[],"rank":1,"createdAt":"2024-05-13T16:51:17.682868Z","updatedAt":"2024-05-13T16:51:17.682868Z","namespaceKey":"default","segmentKeys":[],"segmentOperator":"OR_SEGMENT_OPERATOR"}],"nextPageToken":"","totalCount":1}%
Wasn't able to export from the mounted in config:
$ /flipt export
2024-05-13T16:51:59Z DEBUG configuration source {"path": "/etc/flipt/config/default.yml"}
2024-05-13T16:51:59Z DEBUG constructing builder {"prepared_statements": true}
2024-05-13T16:51:59Z DEBUG list flags {"request": "limit:25 namespace_key:\"default\""}
Error: getting flags: no such table: flags
$
Export from the manually created config:
version: "1.2"
namespace: default
flags:
- key: manual_key
name: manual_key
type: VARIANT_FLAG_TYPE
enabled: true
rules:
- segment: manual_segment
segments:
- key: manual_segment
name: manual_segment
constraints:
- type: STRING_COMPARISON_TYPE
property: email
operator: suffix
value: '@test.com'
match_type: ALL_MATCH_TYPE
thanks for reporting @Rozkipz !
I was able to reproduce myself. It does indeed look like a bug with the declarative storage evaluation. Let me take a deeper look at it and I will be able to give a better estimate of when we can get it fixed!
Also thank you very much for the detailed description! it made it very easy to reproduce
Hey @Rozkipz ! We implemented the fix and will release a bugfix release either tonight or early tomorrow.
Thanks again for finding this issue and reporting!
Wow, thank you @markphelps for the super quick response and fix. We have been loving Flipt and appreciate all the work you've been putting in.
@Rozkipz the fix is now out in https://github.com/flipt-io/flipt/releases/tag/v1.41.2
please let us know if it indeed fixes the issue
Yep that has solved it completely using v1.41.2, thanks again for solving that so quickly.
Any idea when v1.41.2 will make it into helm?
@Rozkipz just merged the helm chart update now. should go out shortly