Skip to content

Commit c5a6a32

Browse files
chore: improve formatting and content (#384)
Signed-off-by: Kavindu Dodanduwa <[email protected]>
1 parent b03fb14 commit c5a6a32

File tree

5 files changed

+72
-73
lines changed

5 files changed

+72
-73
lines changed

docs/annotations.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Example:
88
```yaml
99
metadata:
1010
annotations:
11-
openfeature.dev/enabled: "true"
11+
openfeature.dev/enabled: "true"
1212
```
1313
1414
### `openfeature.dev/flagsourceconfiguration`
@@ -18,11 +18,11 @@ If no namespace is provided it is assumed that the CR is within the same namespa
1818
If multiple CRs are provided, they are merged with the latest taking precedence, for example, in the scenario below, `config-B` will take priority in the merge, replacing duplicated values that are set in `config-A`.
1919

2020
Example:
21-
```
21+
```yaml
2222
metadata:
2323
annotations:
24-
openfeature.dev/enabled: "true"
25-
openfeature.dev/flagsourceconfiguration:"config-A, config-B"`
24+
openfeature.dev/enabled: "true"
25+
openfeature.dev/flagsourceconfiguration: "config-A, config-B"
2626
```
2727

2828
### `openfeature.dev/allowkubernetessync`
@@ -31,25 +31,25 @@ This annotation is used to mark pods which should have their permissions backfil
3131

3232

3333
### `openfeature.dev/featureflagconfiguration`
34-
*This annotation is deprecated in favour of the `openfeature.dev/flagsourceconfiguration` annotation and should no longer be used.*
34+
*This annotation is DEPRECATED in favour of the `openfeature.dev/flagsourceconfiguration` annotation and should no longer be used.*
3535
This annotation specifies the names of the FeatureFlagConfigurations used to configure the injected flagd sidecar.
3636
The annotation value is a comma separated list of values following one of 2 patterns: {NAME} or {NAMESPACE}/{NAME}.
3737
If no namespace is provided it is assumed that the CR is within the same namespace as the deployed pod.
3838
Example:
3939
```yaml
4040
metadata:
4141
annotations:
42-
openfeature.dev/enabled: "true"
43-
openfeature.dev/featureflagconfiguration: "demo, test/demo-2"
42+
openfeature.dev/enabled: "true"
43+
openfeature.dev/featureflagconfiguration: "demo, test/demo-2"
4444
```
4545

4646
### `openfeature.dev`
47-
*This annotation is deprecated in favour of the `openfeature.dev/enabled` annotation and should no longer be used.*
47+
*This annotation is DEPRECATED in favour of the `openfeature.dev/enabled` annotation and should no longer be used.*
4848

4949
When a value of `"enabled"` is provided, the operator will inject a flagd sidecar into the annotated pods.
5050
Example:
5151
```yaml
5252
metadata:
5353
annotations:
54-
openfeature.dev: "enabled"
54+
openfeature.dev: "enabled"
5555
```

docs/feature_flag_configuration.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,14 @@ kind: FeatureFlagConfiguration
88
metadata:
99
name: featureflagconfiguration-sample
1010
spec:
11-
featureFlagSpec:
12-
flags:
13-
foo:
14-
state: "ENABLED"
15-
variants:
16-
bar: "BAR"
17-
baz: "BAZ"
18-
defaultVariant: "bar"
11+
featureFlagSpec:
12+
flags:
13+
foo:
14+
state: "ENABLED"
15+
variants:
16+
bar: "BAR"
17+
baz: "BAZ"
18+
defaultVariant: "bar"
1919
```
2020
2121
## featureFlagSpec

docs/flag_source_configuration.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -39,27 +39,27 @@ The relevant `FlagSourceConfigurations` are passed to the operator by setting th
3939

4040
## FlagSourceConfiguration Fields
4141

42-
| Field | Behavior | Type | Default |
43-
| ----------- | ----------- | ----------- | ----------- |
44-
| MetricsPort | Defines the port for flagd to serve metrics on | optional `int32`| `8013` |
45-
| Port | Defines the port for flagd to listen on | optional `int32` | `8014` |
46-
| SocketPath | Defines the unix socket path to listen on | optional `string` | `""` |
47-
| SyncProviderArgs | String arguments passed to the sidecar on startup, flagd documentation can be found [here](https://github.com/open-feature/flagd/blob/main/docs/configuration/configuration.md) | optional `array of strings`, key values separated by `=`, e.g `key=value` | `""` |
48-
| Image | Allows for the sidecar image to be overridden | optional `string` | `ghcr.io/open-feature/flagd` |
49-
| Tag | Tag to be appended to the sidecar image | optional `string` | `main` |
50-
| Sources | An array of objects defining configuration and sources for each sync provider to use within flagd, documentation of the object is directly below this table | optional `array of objects` |`[]` |
51-
| EnvVars | An array of environment variables to be applied to the sidecar, all names become prepended with the EnvVarPrefix | optional `array of environment variables` | `[]` |
52-
| EnvVarPrefix | String value defining the prefix to be applied to all environment variables applied to the sidecar| optional `string` | `FLAGD` |
53-
| DefaultSyncProvider | Defines the default provider to be used, can be set to `kubernetes`, `filepath` or `http`. | optional `string` | `kubernetes` |
54-
| RolloutOnChange | When set to true the operator will trigger a restart of any `Deployments` within the `FlagSourceConfiguration` reconcile loop, updating the injected sidecar with the latest configuration. | optional `boolean` | `false` |
42+
| Field | Behavior | Type | Default |
43+
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------|------------------------------|
44+
| MetricsPort | Defines the port for flagd to serve metrics on | optional `int32` | `8013` |
45+
| Port | Defines the port for flagd to listen on | optional `int32` | `8014` |
46+
| SocketPath | Defines the unix socket path to listen on | optional `string` | `""` |
47+
| SyncProviderArgs | String arguments passed to the sidecar on startup, flagd documentation can be found [here](https://github.com/open-feature/flagd/blob/main/docs/configuration/configuration.md) | optional `array of strings`, key values separated by `=`, e.g `key=value` | `""` |
48+
| Image | Allows for the sidecar image to be overridden | optional `string` | `ghcr.io/open-feature/flagd` |
49+
| Tag | Tag to be appended to the sidecar image | optional `string` | `main` |
50+
| Sources | An array of objects defining configuration and sources for each sync provider to use within flagd, documentation of the object is directly below this table | optional `array of objects` | `[]` |
51+
| EnvVars | An array of environment variables to be applied to the sidecar, all names become prepended with the EnvVarPrefix | optional `array of environment variables` | `[]` |
52+
| EnvVarPrefix | String value defining the prefix to be applied to all environment variables applied to the sidecar | optional `string` | `FLAGD` |
53+
| DefaultSyncProvider | Defines the default provider to be used, can be set to `kubernetes`, `filepath` or `http`. | optional `string` | `kubernetes` |
54+
| RolloutOnChange | When set to true the operator will trigger a restart of any `Deployments` within the `FlagSourceConfiguration` reconcile loop, updating the injected sidecar with the latest configuration. | optional `boolean` | `false` |
5555

5656
## Source Fields
5757

58-
| Field | Behavior | Type |
59-
| ----------- | ----------- | ----------- |
60-
| Source | Defines the URI of the flag source, this can be either a `host:port` or the `namespace/name` of a `FeatureFlagConfiguration` | `string` |
61-
| Provider | Defines the provider to be used, can be set to `kubernetes`, `filepath` or `http`. If not provided the default sync provider is used. | optional `string` |
62-
| HttpSyncBearerToken | Defines the bearer token to be used with a `http` sync. Has no effect if `Provider` is not `http` | optional `string` |
58+
| Field | Behavior | Type |
59+
|---------------------|---------------------------------------------------------------------------------------------------------------------------------------|-------------------|
60+
| Source | Defines the URI of the flag source, this can be either a `host:port` or the `namespace/name` of a `FeatureFlagConfiguration` | `string` |
61+
| Provider | Defines the provider to be used, can be set to `kubernetes`, `filepath` or `http`. If not provided the default sync provider is used. | optional `string` |
62+
| HttpSyncBearerToken | Defines the bearer token to be used with a `http` sync. Has no effect if `Provider` is not `http` | optional `string` |
6363

6464
## Configuration Merging
6565

@@ -84,7 +84,7 @@ Config-A:
8484
apiVersion: core.openfeature.dev/v1alpha2
8585
kind: FlagSourceConfiguration
8686
metadata:
87-
name: test-configuration-A
87+
name: config-A
8888
spec:
8989
metricsPort: 8080
9090
tag: latest
@@ -94,7 +94,7 @@ Config-B:
9494
apiVersion: core.openfeature.dev/v1alpha2
9595
kind: FlagSourceConfiguration
9696
metadata:
97-
name: test-configuration-B
97+
name: config-B
9898
spec:
9999
port: 8000
100100
tag: main

docs/getting_started.md

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ spec:
8181
matchLabels:
8282
app: my-busybox-curl-app
8383
template:
84-
metadata:
85-
labels:
86-
app: my-busybox-curl-app
87-
annotations:
88-
openfeature.dev/enabled: "true"
89-
openfeature.dev/flagsourceconfiguration: "default/flagsourceconfiguration-sample"
90-
spec:
91-
containers:
84+
metadata:
85+
labels:
86+
app: my-busybox-curl-app
87+
annotations:
88+
openfeature.dev/enabled: "true"
89+
openfeature.dev/flagsourceconfiguration: "default/flagsourceconfiguration-sample"
90+
spec:
91+
containers:
9292
- name: busybox
9393
image: yauritux/busybox-curl:latest
9494
ports:
95-
- containerPort: 80
95+
- containerPort: 80
9696
args:
9797
- sleep
9898
- "30000"
@@ -115,15 +115,15 @@ kubectl describe pod busybox-curl-7bd5767999-spf7v
115115
```
116116
```yaml
117117
flagd:
118-
Image: ghcr.io/open-feature/flagd:v0.4.1
119-
Port: 8014/TCP
120-
Host Port: 0/TCP
118+
Image: ghcr.io/open-feature/flagd:v0.4.1
119+
Port: 8014/TCP
120+
Host Port: 0/TCP
121121
Args:
122122
start
123123
--uri
124124
core.openfeature.dev/default/featureflagconfiguration-sample
125125
Environment:
126-
FLAGD_METRICS_PORT: 8014
126+
FLAGD_METRICS_PORT: 8014
127127
```
128128

129129
Now that we have confirmed that the `flagd` sidecar has been injected and the configuration is correct, we can test the flag evaluation using `curl`.

docs/permissions.md

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -11,46 +11,45 @@ The open feature operator uses the `open-feature-operator-controller-manager` se
1111
The `leader-election-role` provides the operator with the required permissions to perform leader election.
1212
The definition of this role can be found [here](../config/rbac//leader_election_role.yaml)
1313

14-
| API Group | Resource | Verbs |
15-
| ----------- | ----------- | ----------- |
16-
| - | `ConfigMap` | create, delete, get, list, patch, update, watch |
17-
| - | `Event` | create, patch, |
18-
| `coordination.k8s.io` | `Lease` | create, delete, get, list, patch, update, watch |
19-
14+
| API Group | Resource | Verbs |
15+
|-----------------------|-------------|-------------------------------------------------|
16+
| - | `ConfigMap` | create, delete, get, list, patch, update, watch |
17+
| - | `Event` | create, patch, |
18+
| `coordination.k8s.io` | `Lease` | create, delete, get, list, patch, update, watch |
2019

2120
### Manager Role
2221

2322
The `manager-role` applies the rules described below, its definition can be found [here](../config/rbac/role.yaml). It provides the operator with sufficient permissions over the `core.openfeature.dev` resources, and the required permissions for injecting the `flagd` sidecar into appropriate pods. The `ConfigMap` permissions are needed to allow the mounting of `FeatureFlagConfiguration` resources for filepath syncs.
2423

25-
| API Group | Resource | Verbs |
26-
| ----------- | ----------- | ----------- |
27-
| - | `ConfigMap` | create, delete, get, list, patch, update, watch |
28-
| - | `Pod` | create, delete, get, list, patch, update, watch |
29-
| - | `ServiceAccount` | get, list, watch |
30-
| `core.openfeature.dev` | `FeatureFlagConfiguration` | create, delete, get, list, patch, update, watch |
31-
| `core.openfeature.dev` | `FeatureFlagConfiguration Finalizers` | update |
32-
| `core.openfeature.dev` | `FeatureFlagConfiguration Status` | get, patch, update |
33-
| `rbac.authorization.k8s.io` | `ClusterRoleBinding` | get, list, update, watch |
24+
| API Group | Resource | Verbs |
25+
|-----------------------------|---------------------------------------|-------------------------------------------------|
26+
| - | `ConfigMap` | create, delete, get, list, patch, update, watch |
27+
| - | `Pod` | create, delete, get, list, patch, update, watch |
28+
| - | `ServiceAccount` | get, list, watch |
29+
| `core.openfeature.dev` | `FeatureFlagConfiguration` | create, delete, get, list, patch, update, watch |
30+
| `core.openfeature.dev` | `FeatureFlagConfiguration Finalizers` | update |
31+
| `core.openfeature.dev` | `FeatureFlagConfiguration Status` | get, patch, update |
32+
| `rbac.authorization.k8s.io` | `ClusterRoleBinding` | get, list, update, watch |
3433

3534
### Proxy Role
3635

3736
The `proxy-role` definition can be found [here](../config/rbac/auth_proxy_role.yaml)
3837

39-
| API Group | Resource | Verbs |
40-
| ----------- | ----------- | ----------- |
41-
| `authentication.k8s.io` | `Token Review` | create |
42-
| `authentication.k8s.io` | `Subject Access Review` | create |
38+
| API Group | Resource | Verbs |
39+
|-------------------------|-------------------------|--------|
40+
| `authentication.k8s.io` | `Token Review` | create |
41+
| `authentication.k8s.io` | `Subject Access Review` | create |
4342

4443
### Flagd Kubernetes Sync
4544

4645
The `flagd-kubernetes-sync` role providers the permission to get, watch and list all `core.openfeature.dev` resources, permitting the kubernetes sync feature in injected `flagd` containers.
4746
Its definition can be found [here](../config/rbac/flagd_kubernetes_sync_clusterrole.yaml).
4847
During startup the operator will backfill permissions to the `flagd-kubernetes-sync` cluster role binding from the current state of the cluster, adding all service accounts from pods with the `core.openfeature.dev/enabled` annotation set to `"true"`, preventing unexpected behavior during upgrades.
4948

50-
| API Group | Resource | Verbs |
51-
| ----------- | ----------- | ----------- |
52-
| `core.openfeature.dev` | `FlagSourceConfiguration` | get, watch, list |
53-
| `core.openfeature.dev` | `FeatureFlagConfiguration` | get, watch, list |
49+
| API Group | Resource | Verbs |
50+
|------------------------|----------------------------|------------------|
51+
| `core.openfeature.dev` | `FlagSourceConfiguration` | get, watch, list |
52+
| `core.openfeature.dev` | `FeatureFlagConfiguration` | get, watch, list |
5453

5554
When a `Pod` has the `core.openfeature.dev/enabled` annotation value set to `"true"`, its `Service Account` is added as a subject for this role's `Role Binding`, granting it all required permissions for watching its associated `FeatureFlagConfigurations`. As a result `flagd` can provide real time events describing flag configuration changes.
5655

0 commit comments

Comments
 (0)