Skip to content

[opentelemetry-demo] Flagd UI not correctly exposed by frontend-proxy #1897

@fuljo

Description

@fuljo

Problem

The Feature Flags UI (aka Flagd UI) is not accessible via the frontend-proxy at http://localhost:8080/feature as stated in the documentation.

Chart version: opentelemetry-demo-0.38.1

Steps to reproduce

  1. Install the chart as described in the documentation.
  2. Either port-forward the frontend-proxy or expose it via Ingress or Gateway
  3. Navigate to the /feature path to access the Feature Flags UI
  4. You will get a 503, since no backend is available

Cause

As you can see in the following snippet, the flagd-ui container is deployed as a Sidecar container in the flagd pod.

flagd:
enabled: true
imageOverride:
repository: "ghcr.io/open-feature/flagd"
tag: "v0.12.8"
useDefault:
env: true
replicas: 1
ports:
- name: rpc
value: 8013
- name: ofrep
value: 8016
env:
- name: FLAGD_METRICS_EXPORTER
value: otel
- name: FLAGD_OTEL_COLLECTOR_URI
value: $(OTEL_COLLECTOR_NAME):4317
- name: GOMEMLIMIT
value: 60MiB
resources:
limits:
memory: 75Mi
command:
- "/flagd-build"
- "start"
- "--port"
- "8013"
- "--ofrep-port"
- "8016"
- "--uri"
- "file:./etc/flagd/demo.flagd.json"
mountedEmptyDirs:
- name: config-rw
mountPath: /etc/flagd
# flagd-ui as a sidecar container in the same pod so the flag json file can be shared
sidecarContainers:
- name: flagd-ui
useDefault:
env: true
service:
port: 4000
env:
- name: FLAGD_METRICS_EXPORTER
value: otel
- name: OTEL_EXPORTER_OTLP_ENDPOINT
value: http://$(OTEL_COLLECTOR_NAME):4318
- name: FLAGD_UI_PORT
value: "4000"
- name: SECRET_KEY_BASE
value: yYrECL4qbNwleYInGJYvVnSkwJuSQJ4ijPTx5tirGUXrbznFIBFVJdPl5t6O9ASw
- name: PHX_HOST
value: localhost
resources:
limits:
memory: 250Mi
volumeMounts:
- name: config-rw
mountPath: /app/data
initContainers:
- name: init-config
image: busybox
command: ["sh", "-c", "cp /config-ro/demo.flagd.json /config-rw/demo.flagd.json && cat /config-rw/demo.flagd.json"]
volumeMounts:
- mountPath: /config-ro
name: config-ro
- mountPath: /config-rw
name: config-rw
additionalVolumes:
- name: config-ro
configMap:
name: flagd-config

Therefore it is exposed by the flagd service at port 4000, as you can see in the generated manifest:

# Source: opentelemetry-demo/templates/component.yaml
apiVersion: v1
kind: Service
metadata:
name: flagd
labels:
helm.sh/chart: opentelemetry-demo-0.38.1
opentelemetry.io/name: flagd
app.kubernetes.io/component: flagd
app.kubernetes.io/name: flagd
app.kubernetes.io/version: "2.1.3"
app.kubernetes.io/part-of: opentelemetry-demo
app.kubernetes.io/managed-by: Helm
spec:
type: ClusterIP
ports:
- port: 8013
name: rpc
targetPort: 8013
- port: 8016
name: ofrep
targetPort: 8016
- port: 4000
name: tcp-service-0
targetPort: 4000
selector:
opentelemetry.io/name: flagd
---

However, in values.yml, the frontend-proxy component points to the flagd-ui service, which does not exist.
We shall set FLAGD_UI_HOST=flagd.

- name: FLAGD_HOST
value: flagd
- name: FLAGD_PORT
value: "8013"
- name: FLAGD_UI_HOST
value: flagd-ui
- name: FLAGD_UI_PORT
value: "4000"

This error probably originates from the fact that in the .env file in https://github.com/open-telemetry/opentelemetry-demo/ they set FLAGD_UI_HOST=flagd-ui.
But that .env file is used for their docker-compose deployment, where there is indeed a dedicated service for flagd-ui.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions