-
Notifications
You must be signed in to change notification settings - Fork 47
docs: support in-process evaluation #640
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
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
74f5ce4
docs: support in-process evaluation
odubajDT 8782354
create docs for ffipc
odubajDT ee306f8
Apply suggestions from code review
odubajDT a157848
Update docs/feature_flag_in_process_configuration.md
odubajDT 5fad6db
Apply suggestions from code review
odubajDT 13c0ee3
adapt docs
odubajDT 4c93240
Update docs/annotations.md
odubajDT bb42606
cleanup
odubajDT File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
# Feature Flag In-process Configuration | ||
|
||
The `InProcessConfiguration` is a custom resource used to set up the | ||
[configuration options](https://flagd.dev/providers/nodejs/?h=flagd_host#available-configuration-options) | ||
for applications using `OpenFeature operator` with in-process evaluation mode enabled. | ||
|
||
Below you can see a minimal example of `InProcessConfiguration` resource | ||
|
||
```yaml | ||
apiVersion: core.openfeature.dev/v1beta1 | ||
kind: InProcessConfiguration | ||
metadata: | ||
labels: | ||
name: inprocessconfiguration-sample | ||
spec: | ||
port: 2424 | ||
tls: true | ||
offlineFlagSourcePath: "my-path" | ||
cacheMaxSize: 11 | ||
envVarPrefix: "my-prefix" | ||
envVars: | ||
- name: "name1" | ||
value: "val1" | ||
- name: "name2" | ||
value: "val2" | ||
``` | ||
|
||
## How does it work? | ||
|
||
Similar to usage of [FeatureFlagSource](./feature_flag_source.md) configuration, | ||
[annotations](./annotations.md#) are used to allow the injection of configuration data | ||
into the annotated Pod. | ||
The mutating webhook parses the annotations, retrieves the referenced `InProcessConfiguration` resources from the cluster and injects the data from the resource into all containers of the Pod via environment variables, which configure the provider in the workload to consume feature flag configuration from the available [sync implementation](https://flagd.dev/concepts/syncs/#grpc-sync) specified by the configuration. | ||
|
||
## Merging of configurations | ||
|
||
The value of `openfeature.dev/inprocessconfiguration` annotation is a comma separated list of values following one of two patterns: {NAME} or {NAMESPACE}/{NAME}. | ||
If no namespace is provided, it is assumed that the CR is within the same namespace as the deployed pod, for example: | ||
|
||
```yaml | ||
metadata: | ||
annotations: | ||
openfeature.dev/enabled: "true" | ||
openfeature.dev/inprocessconfiguration: "inProcessConfig-A, inProcessConfig-B" | ||
``` | ||
|
||
When multiple `InProcessConfigurations` are provided, the custom resources are merged in runtime and the last `CR` takes precedence over the first, similarly how it's done for `FeatureFlagSource`. | ||
In this example, 2 CRs are being used to set the injected configuration. | ||
|
||
```yaml | ||
apiVersion: core.openfeature.dev/v1beta1 | ||
kind: InProcessConfiguration | ||
metadata: | ||
name: inProcessConfig-A | ||
spec: | ||
port: 2424 | ||
tls: true | ||
offlineFlagSourcePath: "my-path" | ||
cacheMaxSize: 11 | ||
envVarPrefix: "my-prefix" | ||
envVars: | ||
- name: "name1" | ||
value: "val1" | ||
- name: "name2" | ||
value: "val2" | ||
--- | ||
apiVersion: core.openfeature.dev/v1beta1 | ||
kind: InProcessConfiguration | ||
metadata: | ||
name: inProcessConfig-B | ||
spec: | ||
envVarPrefix: "my-second-prefix" | ||
host: "my-host" | ||
``` | ||
|
||
The resources are merged in runtime, which means that no changes are made to the `InProcessConfiguration` resources | ||
in the cluster, but the operator handles the merge and injection internally. | ||
|
||
The resulting configuration will look like the following | ||
|
||
```yaml | ||
apiVersion: core.openfeature.dev/v1beta1 | ||
kind: InProcessConfiguration | ||
metadata: | ||
name: internal | ||
spec: | ||
port: 2424 | ||
tls: true | ||
offlineFlagSourcePath: "my-path" | ||
cacheMaxSize: 11 | ||
envVarPrefix: "my-seconf-prefix" | ||
host: "my-host" | ||
envVars: | ||
- name: "name1" | ||
value: "val1" | ||
- name: "name2" | ||
value: "val2" | ||
``` | ||
|
||
This resulting resource is transformed into environment variables and injected into all containers | ||
of the annotated Pod | ||
|
||
```yaml | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
annotations: | ||
openfeature.dev/enabled: "true" | ||
openfeature.dev/inprocessconfiguration: "inProcessConfig-A, inProcessConfig-B" | ||
name: ofo-pod | ||
spec: | ||
containers: | ||
- name: container1 | ||
image: image1 | ||
env: | ||
- name: my-second-prefix_name2 | ||
value: val2 | ||
- name: my-second-prefix_name1 | ||
value: val1 | ||
- name: my-second-prefix_HOST | ||
value: my-host | ||
- name: my-second-prefix_PORT | ||
value: "2424" | ||
- name: my-second-prefix_TLS | ||
value: "true" | ||
- name: my-second-prefix_OFFLINE_FLAG_SOURCE_PATH | ||
value: my-path | ||
- name: my-second-prefix_MAX_CACHE_SIZE | ||
value: "11" | ||
- name: my-second-prefix_RESOLVER | ||
value: in-process | ||
- name: container2 | ||
image: image2 | ||
env: | ||
- name: my-second-prefix_name2 | ||
value: val2 | ||
- name: my-second-prefix_name1 | ||
value: val1 | ||
- name: my-second-prefix_HOST | ||
value: my-host | ||
- name: my-second-prefix_PORT | ||
value: "2424" | ||
- name: my-second-prefix_TLS | ||
value: "true" | ||
- name: my-second-prefix_OFFLINE_FLAG_SOURCE_PATH | ||
value: my-path | ||
- name: my-second-prefix_MAX_CACHE_SIZE | ||
value: "11" | ||
- name: my-second-prefix_RESOLVER | ||
value: in-process | ||
``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.