diff --git a/testdata/flag-config.yaml b/testdata/flag-config.yaml index c7772da0977..87f9aeafff3 100644 --- a/testdata/flag-config.yaml +++ b/testdata/flag-config.yaml @@ -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 \ No newline at end of file diff --git a/website/src/pages/specification/20241027-flagsets.md b/website/src/pages/specification/20241027-flagsets.md index 684be012b27..bc8e837091e 100644 --- a/website/src/pages/specification/20241027-flagsets.md +++ b/website/src/pages/specification/20241027-flagsets.md @@ -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) | @@ -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