Skip to content

Commit

Permalink
chore: fix file source documentation (#556)
Browse files Browse the repository at this point in the history
Signed-off-by: Kavindu Dodanduwa <kavindudodanduwa@gmail.com>
Co-authored-by: Todd Baert <toddbaert@gmail.com>
  • Loading branch information
Kavindu-Dodan and toddbaert committed Nov 29, 2023
1 parent ccb8c1d commit 318c52d
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 19 deletions.
2 changes: 1 addition & 1 deletion apis/core/v1beta1/featureflagsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ type Source struct {
// Source is a URI of the flag sources
Source string `json:"source"`

// Provider type - kubernetes, http(s), grpc(s) or filepath
// Provider type - kubernetes, http(s), grpc(s) or file
// +optional
Provider common.SyncProviderType `json:"provider"`

Expand Down
2 changes: 1 addition & 1 deletion chart/open-feature-operator/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ The command removes all the Kubernetes components associated with the chart and
| `sidecarConfiguration.image.tag` | Sets the version tag for the injected sidecar. | `v0.7.0` |
| `sidecarConfiguration.providerArgs` | Used to append arguments to the sidecar startup command. This value is a comma separated string of key values separated by '=', e.g. `key=value,key2=value2` results in the appending of `--sync-provider-args key=value --sync-provider-args key2=value2`. | `""` |
| `sidecarConfiguration.envVarPrefix` | Sets the prefix for all environment variables set in the injected sidecar. | `FLAGD` |
| `sidecarConfiguration.defaultSyncProvider` | Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 4 valid sync providers: `kubernetes`, `grpc`, `filepath` and `http`. | `kubernetes` |
| `sidecarConfiguration.defaultSyncProvider` | Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 4 valid sync providers: `kubernetes`, `grpc`, `file` and `http`. | `kubernetes` |
| `sidecarConfiguration.evaluator` | Sets the value of the `XXX_EVALUATOR` environment variable for the injected sidecar container. | `json` |
| `sidecarConfiguration.logFormat` | Sets the value of the `XXX_LOG_FORMAT` environment variable for the injected sidecar container. There are 2 valid log formats: `json` and `console`. | `json` |
| `sidecarConfiguration.probesEnabled` | Enable or Disable Liveness and Readiness probes of the flagd sidecar. When enabled, HTTP probes( paths - `/readyz`, `/healthz`) are set with an initial delay of 5 seconds. | `true` |
Expand Down
2 changes: 1 addition & 1 deletion chart/open-feature-operator/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ sidecarConfiguration:
providerArgs: ""
## @param sidecarConfiguration.envVarPrefix Sets the prefix for all environment variables set in the injected sidecar.
envVarPrefix: "FLAGD"
## @param sidecarConfiguration.defaultSyncProvider Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 4 valid sync providers: `kubernetes`, `grpc`, `filepath` and `http`.
## @param sidecarConfiguration.defaultSyncProvider Sets the value of the `XXX_SYNC_PROVIDER` environment variable for the injected sidecar container. There are 4 valid sync providers: `kubernetes`, `grpc`, `file` and `http`.
defaultSyncProvider: kubernetes
## @param sidecarConfiguration.evaluator Sets the value of the `XXX_EVALUATOR` environment variable for the injected sidecar container.
evaluator: json
Expand Down
3 changes: 1 addition & 2 deletions common/flagdinjector/flagdinjector.go
Original file line number Diff line number Diff line change
Expand Up @@ -280,8 +280,7 @@ func (fi *FlagdContainerInjector) toFilepathProviderConfig(ctx context.Context,
})

return types.SourceConfig{
URI: fmt.Sprintf("%s/%s", mountPath, utils.FeatureFlagConfigMapKey(ns, n)),
// todo - this constant needs to be aligned with flagd. We have a mixed usage of file vs filepath
URI: fmt.Sprintf("%s/%s", mountPath, utils.FeatureFlagConfigMapKey(ns, n)),
Provider: "file",
}, nil
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ spec:
type: string
provider:
description: Provider type - kubernetes, http(s), grpc(s) or
filepath
file
type: string
providerID:
description: ProviderID is an identifier to be used in grpc
Expand Down
2 changes: 1 addition & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ flowchart TD
A[Pod]-->|Annotation: openfeature.dev/featureflagsource| B[FeatureFlagSource CR]
B--> |Flag source| C[FeatureFlag CR]
B--> |Flag source| D[HTTP sync]
B--> |Flag source| E[Filepath sync]
B--> |Flag source| E[File sync]
B--> |Flag source| F[GRPC sync]
B--> |Flag source| G[flagd-proxy]
```
Expand Down
5 changes: 2 additions & 3 deletions docs/concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ The high level architecture of the operator is as follows:

- Kubernetes: sync configuration that configures injected flagd sidecar instances to monitor the Kubernetes API
for changes in flag definition custom resources (`FeatureFlag`).
- filepath: sync configuration that creates and mounts ConfigMap files from flag configuration custom resources
(`FeatureFlag`) and configures injected flagd sidecar instances to monitor them.
- file: sync configuration that creates and mounts ConfigMap files from flag configuration custom resources (`FeatureFlag`) and configures injected flagd sidecar instances to source them.
- grpc: sync configuration that listens for flagd compatible grpc stream
- http: sync configuration which watch and periodically poll flagd compatible http endpoint
- [flagd-proxy](./flagd_proxy.md)
Expand All @@ -38,7 +37,7 @@ able to fetch Feature Flag information. For further information on how to avoid

**When deploying an application via GitOps, we recommend using the `flagd-proxy` mode, which doesn't suffer from the shortcomings above.**

The `"filepath"` provider requires no such communication, but relies on the fact that [Kubernetes automatically updates mounted ConfigMaps](https://kubernetes.io/docs/concepts/configuration/configmap/#mounted-configmaps-are-updated-automatically).
The `"file"` provider requires no such communication, but relies on the fact that [Kubernetes automatically updates mounted ConfigMaps](https://kubernetes.io/docs/concepts/configuration/configmap/#mounted-configmaps-are-updated-automatically).
The disadvantage of this approach is that flag configuration updates may take as long as two minutes to propagate, depending on cluster configuration:

> "the total delay from the moment when the ConfigMap is updated to the moment when new keys are projected to the Pod can be as long as the kubelet sync period + cache propagation delay"
Expand Down
2 changes: 1 addition & 1 deletion docs/crds.md
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ FeatureFlagSourceSpec defines the desired state of FeatureFlagSource
<td><b>provider</b></td>
<td>string</td>
<td>
Provider type - kubernetes, http(s), grpc(s) or filepath<br/>
Provider type - kubernetes, http(s), grpc(s) or file<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down
14 changes: 8 additions & 6 deletions docs/feature_flag_source.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,17 @@ This source type is useful when there is a need for restricting workload permiss

Read more about proxy approach to access kubernetes resources: [flagd-proxy](./flagd_proxy.md)

### filepath
### file

Injected sidecar can use volume mounted files as flag sources.
For this, provider type `filepath` is used as below example,
In this mode, `FeatureFlag` custom resources are volume mounted to the injected flagd sidecar.
flagd then source flag configurations from this volume.

For example, given `FeatureFlag` exist at `flags/sample-flags`, this source configuration look like below,

```yaml
sources:
- source: /etc/flagd/config.json
provider: filepath
- source: flags/sample-flags
provider: file
```

### http
Expand Down Expand Up @@ -125,7 +127,7 @@ spec:
port: 80
evaluator: json
image: my-custom-sidecar-image
defaultSyncProvider: filepath
defaultSyncProvider: file
tag: main
sources:
- source: namespace/name
Expand Down
4 changes: 3 additions & 1 deletion docs/permissions.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ The definition of this role can be found [here](../config/rbac//leader_election_

### Manager Role

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 `FeatureFlag` resources for filepath syncs.
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 `FeatureFlag` resources for file syncs.

| API Group | Resource | Verbs |
|-----------------------------|---------------------------------------|-------------------------------------------------|
Expand Down
2 changes: 1 addition & 1 deletion docs/threat_model.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ flowchart LR

`flagd` makes an authenticated http request to retrieve its initial flag configuration state from the CR. Subsequently, it registers an event handler to listen to changes to the CR. The configuration is at threat of information disclosure and tampering, the security control is authentication.

##### filepath sync provider
##### file sync provider

```mermaid
flowchart LR
Expand Down

0 comments on commit 318c52d

Please sign in to comment.