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

[Bug]: Rules aren't being linked correctly when importing features from a config file #3076

Closed
1 task done
Rozkipz opened this issue May 13, 2024 · 7 comments · Fixed by #3078
Closed
1 task done
Labels

Comments

@Rozkipz
Copy link

Rozkipz commented May 13, 2024

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.

image
image
image
image

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

  • 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 -
image

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
@Rozkipz Rozkipz added the bug label May 13, 2024
@markphelps
Copy link
Collaborator

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!

@markphelps
Copy link
Collaborator

Also thank you very much for the detailed description! it made it very easy to reproduce

@markphelps
Copy link
Collaborator

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!

@Rozkipz
Copy link
Author

Rozkipz commented May 14, 2024

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.

@markphelps
Copy link
Collaborator

@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

@Rozkipz
Copy link
Author

Rozkipz commented May 14, 2024

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?

@markphelps
Copy link
Collaborator

@Rozkipz just merged the helm chart update now. should go out shortly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants