open-feature-operator icon indicating copy to clipboard operation
open-feature-operator copied to clipboard

The in-process flagd pod does not use the default value of FeatureFlagSource

Open kencharos opened this issue 1 year ago • 1 comments

Hi, open feature operator is nice tool. I will report what I have noticed.

version: 0.7.0

I applied following manifest to deploy standalone flagd pod.

---
apiVersion: core.openfeature.dev/v1beta1
kind: FeatureFlagSource
metadata:
  name: sample-sources
  labels:
    app: sample-flags
spec:
  sources:
    - source: test-flag
      provider: kubernetes
---
apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
metadata:
  name: flagd
spec:
  replicas: 1
  serviceType: ClusterIP
  serviceAccountName: default
  featureFlagSource: sample-sources

As a result, flagd pod was generated with no default values used , as shown below.

kubectl describe pod flagd-5f4cfcb898-nwflf
Name:             flagd-5f4cfcb898-nwflf
Namespace:        default
Priority:         0
Service Account:  default
Node:             minikube/192.168.49.2
Start Time:       Fri, 26 Jul 2024 11:20:38 +0900
Labels:           app=flagd-in-process
                  app.kubernetes.io/managed-by=open-feature-operator
                  app.kubernetes.io/name=flagd
                  app.kubernetes.io/version=v0.10.3
                  pod-template-hash=5f4cfcb898
Annotations:      <none>
Status:           Running
IP:               10.244.0.71
IPs:
  IP:           10.244.0.71
Controlled By:  ReplicaSet/flagd-5f4cfcb898
Containers:
  flagd:
    Container ID:    docker://7568edc4a1e1ce366da1579c7da1eee5c93c42354df089e8a6fcfa2870033e0f
    Image:           ghcr.io/open-feature/flagd:v0.10.3
    Image ID:        docker-pullable://ghcr.io/open-feature/flagd@sha256:cc87349925a1643cd3f6e4f894ef6b6b3139712baf78133f3aed70a6b66f69bd
    Ports:           8014/TCP, 8013/TCP, 8016/TCP, 8015/TCP
    Host Ports:      0/TCP, 0/TCP, 0/TCP, 0/TCP
    SeccompProfile:  RuntimeDefault
    Args:
      start
      --management-port
      0
      --sources
      [{"uri":"default/sample-flags","provider":"kubernetes"}]
    State:          Running
      Started:      Fri, 26 Jul 2024 11:20:39 +0900
    Ready:          True
    Restart Count:  0
    Limits:
      cpu:     500m
      memory:  64Mi
    Requests:
      cpu:     200m
      memory:  32Mi
    Environment:
      _MANAGEMENT_PORT:  0
      _PORT:             0
      _EVALUATOR:        
      _LOG_FORMAT:       
      _RESOLVER:         rpc

When creating a pod from a Flagd manifest, the default values listed below do not appear to be used.

https://github.com/open-feature/open-feature-operator/blob/main/apis/core/v1beta1/featureflagsource_types.go

In the current version, the default value must be set explicitly.

apiVersion: core.openfeature.dev/v1beta1
kind: Flagd
metadata:
  name: flagd
spec:
  # Fill default values
  port: 8013
  managementPort: 8014
  envVarPrefix: FLAGD
  replicas: 1
  serviceType: ClusterIP
  serviceAccountName: default
  featureFlagSource: sample-sources

Thanks.

kencharos avatar Jul 26 '24 02:07 kencharos

This may have been fixed with some other recent changes since 0.7.0, but I'm not sure. It's definitely a bug.

toddbaert avatar Oct 02 '24 15:10 toddbaert