summaryrefslogtreecommitdiff
path: root/astroshop-helm/flagd
diff options
context:
space:
mode:
authorSaumit <justsaumit@protonmail.com>2025-10-04 01:36:57 +0530
committerSaumit <justsaumit@protonmail.com>2025-10-04 01:36:57 +0530
commitdf2bd058309ac234eebdad3b0682a137e27dfc44 (patch)
tree39be2243787c3bdd595ae123766565f80a8a039c /astroshop-helm/flagd
parent90a62ae7ea5e745b99d8ac8d08ae837bbaedfce5 (diff)
Add tested Helm chart and configuration files for OpenTelemetry demo services
Diffstat (limited to 'astroshop-helm/flagd')
-rw-r--r--astroshop-helm/flagd/.helmignore23
-rw-r--r--astroshop-helm/flagd/Chart.yaml22
-rw-r--r--astroshop-helm/flagd/templates/_helpers.tpl62
-rw-r--r--astroshop-helm/flagd/templates/config.yaml10
-rw-r--r--astroshop-helm/flagd/templates/deployment.yaml127
-rw-r--r--astroshop-helm/flagd/templates/service.yaml16
-rw-r--r--astroshop-helm/flagd/values.yaml159
7 files changed, 419 insertions, 0 deletions
diff --git a/astroshop-helm/flagd/.helmignore b/astroshop-helm/flagd/.helmignore
new file mode 100644
index 0000000..0e8a0eb
--- /dev/null
+++ b/astroshop-helm/flagd/.helmignore
@@ -0,0 +1,23 @@
+# Patterns to ignore when building packages.
+# This supports shell glob matching, relative path matching, and
+# negation (prefixed with !). Only one pattern per line.
+.DS_Store
+# Common VCS dirs
+.git/
+.gitignore
+.bzr/
+.bzrignore
+.hg/
+.hgignore
+.svn/
+# Common backup files
+*.swp
+*.bak
+*.tmp
+*.orig
+*~
+# Various IDEs
+.project
+.idea/
+*.tmproj
+.vscode/
diff --git a/astroshop-helm/flagd/Chart.yaml b/astroshop-helm/flagd/Chart.yaml
new file mode 100644
index 0000000..e95d6b0
--- /dev/null
+++ b/astroshop-helm/flagd/Chart.yaml
@@ -0,0 +1,22 @@
+apiVersion: v2
+name: flagd
+description: A Helm chart for Kubernetes
+# A chart can be either an 'application' or a 'library' chart.
+#
+# Application charts are a collection of templates that can be packaged into versioned archives
+# to be deployed.
+#
+# Library charts provide useful utilities or functions for the chart developer. They're included as
+# a dependency of application charts to inject those utilities and functions into the rendering
+# pipeline. Library charts do not define any templates and therefore cannot be deployed.
+type: application
+# This is the chart version. This version number should be incremented each time you make changes
+# to the chart and its templates, including the app version.
+# Versions are expected to follow Semantic Versioning (https://semver.org/)
+version: 0.1.0
+# This is the version number of the application being deployed. This version number should be
+# incremented each time you make changes to the application. Versions are not expected to
+# follow Semantic Versioning. They should reflect the version the application is using.
+# It is recommended to use it with quotes.
+appVersion: "2.1.3"
+namespace: opentelemetry-demo \ No newline at end of file
diff --git a/astroshop-helm/flagd/templates/_helpers.tpl b/astroshop-helm/flagd/templates/_helpers.tpl
new file mode 100644
index 0000000..b3d106d
--- /dev/null
+++ b/astroshop-helm/flagd/templates/_helpers.tpl
@@ -0,0 +1,62 @@
+{{/*
+Expand the name of the chart.
+*/}}
+{{- define "flagd.name" -}}
+{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Create a default fully qualified app name.
+We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
+If release name contains chart name it will be used as a full name.
+*/}}
+{{- define "flagd.fullname" -}}
+{{- if .Values.fullnameOverride }}
+{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- $name := default .Chart.Name .Values.nameOverride }}
+{{- if contains $name .Release.Name }}
+{{- .Release.Name | trunc 63 | trimSuffix "-" }}
+{{- else }}
+{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }}
+{{- end }}
+{{- end }}
+{{- end }}
+
+{{/*
+Create chart name and version as used by the chart label.
+*/}}
+{{- define "flagd.chart" -}}
+{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
+{{- end }}
+
+{{/*
+Common labels
+*/}}
+{{- define "flagd.labels" -}}
+helm.sh/chart: {{ include "flagd.chart" . }}
+{{ include "flagd.selectorLabels" . }}
+{{- if .Chart.AppVersion }}
+app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
+{{- end }}
+app.kubernetes.io/managed-by: {{ .Release.Service }}
+{{- end }}
+
+{{/*
+Selector labels
+*/}}
+{{- define "flagd.selectorLabels" -}}
+app.kubernetes.io/name: {{ include "flagd.name" . }}
+app.kubernetes.io/instance: {{ .Release.Name }}
+{{- end }}
+
+{{/*
+Create the name of the service account to use
+*/}}
+{{- define "flagd.serviceAccountName" -}}
+{{- if .Values.serviceAccount.create }}
+{{- default (include "flagd.fullname" .) .Values.serviceAccount.name }}
+{{- else }}
+{{- default "default" .Values.serviceAccount.name }}
+{{- end }}
+{{- end }}
diff --git a/astroshop-helm/flagd/templates/config.yaml b/astroshop-helm/flagd/templates/config.yaml
new file mode 100644
index 0000000..9eab225
--- /dev/null
+++ b/astroshop-helm/flagd/templates/config.yaml
@@ -0,0 +1,10 @@
+apiVersion: v1
+kind: ConfigMap
+metadata:
+ name: {{ include "flagd.fullname" . }}-config
+ labels:
+ app.kubernetes.io/part-of: opentelemetry-demo
+ opentelemetry.io/name: opentelemetry-demo
+ {{- include "flagd.labels" . | nindent 4 }}
+data:
+ demo.flagd.json: {{ .Values.config.demoFlagdJson | toYaml | indent 1 }}
diff --git a/astroshop-helm/flagd/templates/deployment.yaml b/astroshop-helm/flagd/templates/deployment.yaml
new file mode 100644
index 0000000..13b9b5e
--- /dev/null
+++ b/astroshop-helm/flagd/templates/deployment.yaml
@@ -0,0 +1,127 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+ namespace: {{ .Values.namespace }}
+ name: {{ include "flagd.fullname" . }}
+ labels:
+ app.kubernetes.io/component: flagd
+ app.kubernetes.io/part-of: opentelemetry-demo
+ opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ {{- include "flagd.labels" . | nindent 4 }}
+spec:
+ replicas: {{ .Values.opentelemetryDemoFlagd.replicas }}
+ revisionHistoryLimit: {{ .Values.opentelemetryDemoFlagd.revisionHistoryLimit }}
+ selector:
+ matchLabels:
+ opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ {{- include "flagd.selectorLabels" . | nindent 6 }}
+ template:
+ metadata:
+ labels:
+ app.kubernetes.io/component: flagd
+ app.kubernetes.io/instance: opentelemetry-demo
+ app.kubernetes.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ {{- include "flagd.selectorLabels" . | nindent 8 }}
+ spec:
+ containers:
+ - command:
+ - /flagd-build
+ - start
+ - --uri
+ - file:./etc/flagd/demo.flagd.json
+ env:
+ - name: OTEL_SERVICE_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.labels['app.kubernetes.io/component']
+ - name: OTEL_COLLECTOR_NAME
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelCollectorName }}
+ - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelExporterOtlpMetricsTemporalityPreference
+ }}
+ - name: FLAGD_METRICS_EXPORTER
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.flagdMetricsExporter
+ }}
+ - name: FLAGD_OTEL_COLLECTOR_URI
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.flagdOtelCollectorUri
+ }}
+ - name: OTEL_RESOURCE_ATTRIBUTES
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagd.env.otelResourceAttributes
+ }}
+ - name: KUBERNETES_CLUSTER_DOMAIN
+ value: {{ quote .Values.kubernetesClusterDomain }}
+ image: {{ .Values.opentelemetryDemoFlagd.flagd.image.repository }}:{{ .Values.opentelemetryDemoFlagd.flagd.image.tag
+ | default .Chart.AppVersion }}
+ imagePullPolicy: {{ .Values.opentelemetryDemoFlagd.flagd.imagePullPolicy }}
+ name: flagd
+ ports:
+ - containerPort: 8013
+ name: service
+ resources: {{- toYaml .Values.opentelemetryDemoFlagd.flagd.resources | nindent
+ 10 }}
+ volumeMounts:
+ - mountPath: /etc/flagd
+ name: config-rw
+ - env:
+ - name: OTEL_SERVICE_NAME
+ valueFrom:
+ fieldRef:
+ apiVersion: v1
+ fieldPath: metadata.labels['app.kubernetes.io/component']
+ - name: OTEL_COLLECTOR_NAME
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelCollectorName
+ }}
+ - name: OTEL_EXPORTER_OTLP_METRICS_TEMPORALITY_PREFERENCE
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelExporterOtlpMetricsTemporalityPreference
+ }}
+ - name: FLAGD_METRICS_EXPORTER
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.flagdMetricsExporter
+ }}
+ - name: OTEL_EXPORTER_OTLP_ENDPOINT
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelExporterOtlpEndpoint
+ }}
+ - name: OTEL_RESOURCE_ATTRIBUTES
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.otelResourceAttributes
+ }}
+ - name: KUBERNETES_CLUSTER_DOMAIN
+ value: {{ quote .Values.kubernetesClusterDomain }}
+ - name: SECRET_KEY_BASE
+ value: {{ quote .Values.opentelemetryDemoFlagd.flagdui.env.secretKeyBase }}
+ image: {{ .Values.opentelemetryDemoFlagd.flagdui.image.repository }}:{{ .Values.opentelemetryDemoFlagd.flagdui.image.tag
+ | default .Chart.AppVersion }}
+ imagePullPolicy: {{ .Values.opentelemetryDemoFlagd.flagdui.imagePullPolicy }}
+ name: flagdui
+ ports:
+ - containerPort: 4000
+ name: service
+ resources: {{- toYaml .Values.opentelemetryDemoFlagd.flagdui.resources | nindent
+ 10 }}
+ volumeMounts:
+ - mountPath: /app/data
+ name: config-rw
+ initContainers:
+ - command:
+ - sh
+ - -c
+ - cp /config-ro/demo.flagd.json /config-rw/demo.flagd.json && cat /config-rw/demo.flagd.json
+ env:
+ - name: KUBERNETES_CLUSTER_DOMAIN
+ value: {{ quote .Values.kubernetesClusterDomain }}
+ image: {{ .Values.opentelemetryDemoFlagd.initConfig.image.repository }}:{{ .Values.opentelemetryDemoFlagd.initConfig.image.tag
+ | default .Chart.AppVersion }}
+ name: init-config
+ resources: {}
+ volumeMounts:
+ - mountPath: /config-ro
+ name: config-ro
+ - mountPath: /config-rw
+ name: config-rw
+ serviceAccountName: {{ .Values.serviceAccount.name }}
+ volumes:
+ - emptyDir: {}
+ name: config-rw
+ - configMap:
+ name: {{ include "flagd.fullname" . }}-config
+ name: config-ro
diff --git a/astroshop-helm/flagd/templates/service.yaml b/astroshop-helm/flagd/templates/service.yaml
new file mode 100644
index 0000000..46eb89b
--- /dev/null
+++ b/astroshop-helm/flagd/templates/service.yaml
@@ -0,0 +1,16 @@
+apiVersion: v1
+kind: Service
+metadata:
+ name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ labels:
+ app.kubernetes.io/component: flagd
+ app.kubernetes.io/part-of: opentelemetry-demo
+ opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ {{- include "flagd.labels" . | nindent 4 }}
+spec:
+ type: {{ .Values.opentelemetryDemoFlagd.type }}
+ selector:
+ opentelemetry.io/name: {{ .Values.namespace }}-{{ include "flagd.fullname" . }}
+ {{- include "flagd.selectorLabels" . | nindent 4 }}
+ ports:
+ {{- .Values.opentelemetryDemoFlagd.ports | toYaml | nindent 2 }}
diff --git a/astroshop-helm/flagd/values.yaml b/astroshop-helm/flagd/values.yaml
new file mode 100644
index 0000000..bfdbc88
--- /dev/null
+++ b/astroshop-helm/flagd/values.yaml
@@ -0,0 +1,159 @@
+config:
+ demoFlagdJson: |-
+ {
+ "$schema": "https://flagd.dev/schema/v0/flags.json",
+ "flags": {
+ "productCatalogFailure": {
+ "description": "Fail product catalog service on a specific product",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "recommendationServiceCacheFailure": {
+ "description": "Fail recommendation service cache",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "adServiceManualGc": {
+ "description": "Triggers full manual garbage collections in the ad service",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "adServiceHighCpu": {
+ "description": "Triggers high cpu load in the ad service",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "adServiceFailure": {
+ "description": "Fail ad service",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "kafkaQueueProblems": {
+ "description": "Overloads Kafka queue while simultaneously introducing a consumer side delay leading to a lag spike",
+ "state": "ENABLED",
+ "variants": {
+ "on": 100,
+ "off": 0
+ },
+ "defaultVariant": "off"
+ },
+ "cartServiceFailure": {
+ "description": "Fail cart service",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "paymentServiceFailure": {
+ "description": "Fail payment service charge requests",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "paymentServiceUnreachable": {
+ "description": "Payment service is unavailable",
+ "state": "ENABLED",
+ "variants": {
+ "on": true,
+ "off": false
+ },
+ "defaultVariant": "off"
+ },
+ "loadgeneratorFloodHomepage": {
+ "description": "Flood the frontend with a large amount of requests.",
+ "state": "ENABLED",
+ "variants": {
+ "on": 100,
+ "off": 0
+ },
+ "defaultVariant": "off"
+ },
+ "imageSlowLoad": {
+ "description": "slow loading images in the frontend",
+ "state": "ENABLED",
+ "variants": {
+ "10sec": 10000,
+ "5sec": 5000,
+ "off": 0
+ },
+ "defaultVariant": "off"
+ }
+ }
+ }
+namespace: opentelemetry-demo
+kubernetesClusterDomain: cluster.local
+
+serviceAccount:
+ name: opentelemetry-demo
+ version: ">=1.32.0-0"
+ partOf: opentelemetry-demo
+
+opentelemetryDemoFlagd:
+ flagd:
+ env:
+ flagdMetricsExporter: otel
+ flagdOtelCollectorUri: $(OTEL_COLLECTOR_NAME):4317
+ otelCollectorName: opentelemetry-demo-otelcol
+ otelExporterOtlpMetricsTemporalityPreference: cumulative
+ otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3
+ image:
+ repository: ghcr.io/open-feature/flagd
+ tag: v0.11.1
+ imagePullPolicy: IfNotPresent
+ resources:
+ limits:
+ memory: 512Mi
+ flagdui:
+ env:
+ flagdMetricsExporter: otel
+ otelCollectorName: opentelemetry-demo-otelcol
+ otelExporterOtlpEndpoint: http://$(OTEL_COLLECTOR_NAME):4318
+ otelExporterOtlpMetricsTemporalityPreference: cumulative
+ otelResourceAttributes: service.name=$(OTEL_SERVICE_NAME),service.namespace=opentelemetry-demo,service.version=2.1.3
+ secretKeyBase: yYrECL4qbNwleYInGJYvVnSkwJuSQJ4ijPTx5tirGUXrbznFIBFVJdPl5t6O9ASw
+ image:
+ repository: ghcr.io/open-telemetry/demo
+ tag: 2.1.3-flagd-ui
+ imagePullPolicy: IfNotPresent
+ resources:
+ limits:
+ memory: 512Mi
+ initConfig:
+ image:
+ repository: busybox
+ tag: latest
+ ports:
+ - name: tcp-service
+ port: 8013
+ targetPort: 8013
+ - name: tcp-service-0
+ port: 4000
+ targetPort: 4000
+ replicas: 1
+ revisionHistoryLimit: 10
+ type: ClusterIP