Skip to content

Commit db7a4c7

Browse files
Add solution 3
Signed-off-by: Thomas Poignant <[email protected]>
1 parent 8857eda commit db7a4c7

File tree

2 files changed

+98
-4
lines changed

2 files changed

+98
-4
lines changed

testdata/flag-config.yaml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,21 @@ test-flag2:
3030
defaultRule:
3131
name: defaultRule
3232
variation: Default
33+
34+
flagSets:
35+
- name: set-team-1
36+
flags:
37+
test-flag2:
38+
variations:
39+
Default: false
40+
False: false
41+
True: true
42+
targeting:
43+
- name: rule1
44+
query: key eq "not-a-key"
45+
percentage:
46+
False: 0
47+
True: 100
48+
defaultRule:
49+
name: defaultRule
50+
variation: Default

website/src/pages/specification/20241027-flagsets.md

Lines changed: 80 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Description: Flag sets are a way to group flags together.
88
| | |
99
|----------------------|---------------------------------------------------|
1010
| **Creation Date** | 27/10/2024 |
11-
| **Last Update Date** | 27/10/2024 |
11+
| **Last Update Date** | 18/12/2024 |
1212
| **Authors** | Thomas Poignant |
1313
| **Status** | ![draft](https://img.shields.io/badge/-draft-red) |
1414

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

175175
### Solution 3
176-
:::note
177-
Feel free to propose other solutions here.
178-
:::
176+
In this solution we want to offer multiple way to specify the flag set in the configuration.
177+
This solution will be more complex to implement, but it will give more flexibility to the users.
178+
179+
In this solution the flag set could be defined:
180+
1. In the retriever configuration _(like in solution 2)_.
181+
2. And in the flag configuration file with a specific format.
182+
183+
#### example: In the retriever configuration
184+
185+
The relay proxy configuration will look like this:
186+
```yaml
187+
# ...
188+
retrievers:
189+
- kind: file
190+
path: config-file.goff.yaml
191+
flagSet: flagset-teamA
192+
# ...
193+
```
194+
195+
And the flag configuration file (`config-file.goff.yaml`) will look like this:
196+
```yaml
197+
# all the flags in this file will be part of the flag set flagset-teamA
198+
# ...
199+
test-flag:
200+
variations:
201+
enabled: true
202+
disabled: false
203+
defaultRule:
204+
variation: enabled
205+
# ...
206+
```
207+
208+
#### example: In the flag configuration file with a specific format
209+
210+
In that case we don't need to specify the flag set in the retriever configuration.
211+
The relay proxy configuration will look like this:
212+
```yaml
213+
# ...
214+
retrievers:
215+
- kind: file
216+
path: config-file.goff.yaml
217+
# ...
218+
```
219+
220+
And the flag configuration file (`config-file.goff.yaml`) will look like this:
221+
```yaml
222+
# flagSets is a new key in the configuration file, that allow to create a super set with multiple flag sets.
223+
flagSets:
224+
- name: flagset-teamA
225+
flags:
226+
test-flag2:
227+
variations:
228+
Default: false
229+
False: false
230+
True: true
231+
targeting:
232+
- name: rule1
233+
query: key eq "not-a-key"
234+
percentage:
235+
False: 0
236+
True: 100
237+
defaultRule:
238+
name: defaultRule
239+
variation: Default
240+
- name: flagset-teamB
241+
flags:
242+
test-flag2:
243+
# ...
244+
```
245+
246+
**PRO**
247+
- It gives flexibility in the way of creating the flag sets _(in the retriever or in the flag configuration file)_.
248+
- We can create multiple flag sets from a single retriver, by generating multiple flag sets in the flag configuration file.
249+
- We can still have multiple files for 1 flag set _(by specifying the same `flagSet` name in each file)_.
250+
- If we don't want to change the format of our configuration file, we can still set the flag sey in the retriever configuration.
251+
252+
**CON**
253+
- 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)._
254+
- It is a bit more complex to implement than the other solutions.
179255

180256
## Decision
181257

0 commit comments

Comments
 (0)