Skip to content

Commit

Permalink
Add solution 3
Browse files Browse the repository at this point in the history
Signed-off-by: Thomas Poignant <[email protected]>
  • Loading branch information
thomaspoignant committed Dec 18, 2024
1 parent 8857eda commit db7a4c7
Show file tree
Hide file tree
Showing 2 changed files with 98 additions and 4 deletions.
18 changes: 18 additions & 0 deletions testdata/flag-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,21 @@ test-flag2:
defaultRule:
name: defaultRule
variation: Default

flagSets:
- name: set-team-1
flags:
test-flag2:
variations:
Default: false
False: false
True: true
targeting:
- name: rule1
query: key eq "not-a-key"
percentage:
False: 0
True: 100
defaultRule:
name: defaultRule
variation: Default
84 changes: 80 additions & 4 deletions website/src/pages/specification/20241027-flagsets.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Description: Flag sets are a way to group flags together.
| | |
|----------------------|---------------------------------------------------|
| **Creation Date** | 27/10/2024 |
| **Last Update Date** | 27/10/2024 |
| **Last Update Date** | 18/12/2024 |
| **Authors** | Thomas Poignant |
| **Status** | ![draft](https://img.shields.io/badge/-draft-red) |

Expand Down Expand Up @@ -173,9 +173,85 @@ authorizedKeys:
- If we want the same flag to be part of multiple flag sets, we need to duplicate the flag in multiple files.

### Solution 3
:::note
Feel free to propose other solutions here.
:::
In this solution we want to offer multiple way to specify the flag set in the configuration.
This solution will be more complex to implement, but it will give more flexibility to the users.

In this solution the flag set could be defined:
1. In the retriever configuration _(like in solution 2)_.
2. And in the flag configuration file with a specific format.

#### example: In the retriever configuration

The relay proxy configuration will look like this:
```yaml
# ...
retrievers:
- kind: file
path: config-file.goff.yaml
flagSet: flagset-teamA
# ...
```

And the flag configuration file (`config-file.goff.yaml`) will look like this:
```yaml
# all the flags in this file will be part of the flag set flagset-teamA
# ...
test-flag:
variations:
enabled: true
disabled: false
defaultRule:
variation: enabled
# ...
```

#### example: In the flag configuration file with a specific format

In that case we don't need to specify the flag set in the retriever configuration.
The relay proxy configuration will look like this:
```yaml
# ...
retrievers:
- kind: file
path: config-file.goff.yaml
# ...
```

And the flag configuration file (`config-file.goff.yaml`) will look like this:
```yaml
# flagSets is a new key in the configuration file, that allow to create a super set with multiple flag sets.
flagSets:
- name: flagset-teamA
flags:
test-flag2:
variations:
Default: false
False: false
True: true
targeting:
- name: rule1
query: key eq "not-a-key"
percentage:
False: 0
True: 100
defaultRule:
name: defaultRule
variation: Default
- name: flagset-teamB
flags:
test-flag2:
# ...
```

**PRO**
- It gives flexibility in the way of creating the flag sets _(in the retriever or in the flag configuration file)_.
- We can create multiple flag sets from a single retriver, by generating multiple flag sets in the flag configuration file.
- We can still have multiple files for 1 flag set _(by specifying the same `flagSet` name in each file)_.
- If we don't want to change the format of our configuration file, we can still set the flag sey in the retriever configuration.

**CON**
- If we configure a flag set name both in the retriever and in the flag configuration file, we need to decide which one to use _(most likely the one in the file)._
- It is a bit more complex to implement than the other solutions.

## Decision

Expand Down

0 comments on commit db7a4c7

Please sign in to comment.