open-feature-operator
The open-feature-operator is a Kubernetes native operator that allows you to expose feature flags to your applications. It injects a flagd sidecar into your pod and allows you to poll the flagd server for feature flags in a variety of ways.
Architecture
As per the issue here High level architecture is as follows:
Example
When wishing to leverage featureflagging within the local pod, the following steps are required:
- Create a new feature flag custom resource e.g.
apiVersion: core.openfeature.dev/v1alpha1
kind: FeatureFlagConfiguration
metadata:
name: featureflagconfiguration-sample
spec:
featureFlagSpec: |
{
"foo" : "bar"
}
- Reference the CR within the pod spec annotations
apiVersion: v1
kind: Pod
metadata:
name: nginx
annotations:
openfeature.dev: "enabled"
openfeature.dev/featureflagconfiguration: "featureflagconfiguration-sample"
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
- Example usage from host container
root@nginx:/# curl localhost:8080
{
"foo" : "bar"
}
Running the operator locally
- Create a local cluster with MicroK8s or Kind
kubectl create ns 'open-feature-operator-system'
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.8.0/cert-manager.yaml
kubectl apply -f config/webhook/certificate.yaml
IMG=ghcr.io/open-feature/open-feature-operator:main make deploy
Run the example
kubectl apply -f config/samples/config_v1alpha1_featureflagconfiguration.yaml
kubectl apply -f config/samples/pod.yaml