flagd-proxy

command module
v0.6.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

README

Kube Flagd Proxy

experimental

The kube flagd proxy acts as a pub sub for deployed flagd sidecar containers to subscribe to change events in FeatureFlag CRs.

On request, the flagd-proxy will spawn a goroutine to watch the CR using the `core` package Kubernetes sync. Each further request for the same resource will add a new stream to the broadcast list. Once all streams have been closed and there are no longer any listeners for a given resource, the sync will be closed.

The flagd-proxy API follows the flagd grpc spec, found in the buf schema registry, as such the existing grpc sync can be used to subscribe to the CR changes.

Deployment

The proxy can be deployed to any namespace, provided that the associated service account has been added to the flagd-kubernetes-sync cluster role binding. A sample deployment can be found in /config/deployments/flagd-proxy requiring the namespace flagd-proxy to be deployed.

kubectl create namespace flagd-proxy
kubectl apply -f ./config/deployments/flagd-proxy

Once the flagd-proxy has been deployed, any flagd instances subscribe to flag changes using the grpc sync, providing the target resource uri using the selector configuration field.

apiVersion: v1
kind: Pod
metadata:
  name: flagd
spec:
  containers:
  - name: flagd
    image: ghcr.io/open-feature/flagd:latest
    ports:
    - containerPort: 8013
    args:
    - start
    - --sources
    - '[{"uri":"flagd-proxy-svc.flagd-proxy.svc.cluster.local:8015","provider":"grpc","selector":"core.openfeature.dev/NAMESPACE/NAME"}]'
    - --debug
---
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlag
metadata:
  name: end-to-end
spec:
  flagSpec:
    flags:
      color:
        state: ENABLED
        variants:
          red: CC0000
          green: 00CC00
          blue: 0000CC
          yellow: yellow
        defaultVariant: yellow

Once deployed, the client flagd instance will receive almost instant flag configuration change events.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
pkg

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL