From c214cae8f102034018aeb0554a9f09ec8385f31b Mon Sep 17 00:00:00 2001 From: Alexandre Vazquez Date: Fri, 4 Jul 2025 13:59:59 +0200 Subject: [PATCH] Add optional ads.txt support to Helm chart --- charts/xslt-playground/Chart.yaml | 2 +- charts/xslt-playground/README.md | 1 + .../xslt-playground/templates/ads-configmap.yaml | 11 +++++++++++ .../templates/frontend-deployment.yaml | 16 ++++++++++++++++ charts/xslt-playground/values.yaml | 3 +++ 5 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 charts/xslt-playground/templates/ads-configmap.yaml diff --git a/charts/xslt-playground/Chart.yaml b/charts/xslt-playground/Chart.yaml index f132d6ad..3f04cd3b 100644 --- a/charts/xslt-playground/Chart.yaml +++ b/charts/xslt-playground/Chart.yaml @@ -1,6 +1,6 @@ apiVersion: v2 name: xslt-playground description: Helm chart for xslt-playground frontend and backend -version: 0.1.1 +version: 0.1.2 appVersion: "0.1.0" diff --git a/charts/xslt-playground/README.md b/charts/xslt-playground/README.md index 9aed9d08..92f0435d 100644 --- a/charts/xslt-playground/README.md +++ b/charts/xslt-playground/README.md @@ -22,6 +22,7 @@ Key parameters in `values.yaml`: The frontend reads this variable at runtime so changing the deployment does not require rebuilding the image. When empty it defaults to the internal backend service URL. +- `adsTxt` – optional content for an `ads.txt` file served by the frontend pod. - `hpa` – enable CPU-based autoscaling for both deployments. When `firebase.enabled` is true you must create the secret before installing the chart: diff --git a/charts/xslt-playground/templates/ads-configmap.yaml b/charts/xslt-playground/templates/ads-configmap.yaml new file mode 100644 index 00000000..07651877 --- /dev/null +++ b/charts/xslt-playground/templates/ads-configmap.yaml @@ -0,0 +1,11 @@ +{{- if .Values.adsTxt }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ include "xslt-playground.fullname" . }}-ads + labels: + {{- include "xslt-playground.labels" . | nindent 4 }} +data: + ads.txt: | +{{ .Values.adsTxt | indent 4 }} +{{- end }} diff --git a/charts/xslt-playground/templates/frontend-deployment.yaml b/charts/xslt-playground/templates/frontend-deployment.yaml index 125ffd23..ce1b53dc 100644 --- a/charts/xslt-playground/templates/frontend-deployment.yaml +++ b/charts/xslt-playground/templates/frontend-deployment.yaml @@ -29,8 +29,24 @@ spec: secretKeyRef: name: {{ .Values.firebase.secretName }} key: {{ .Values.firebase.configKey }} +{{- end }} +{{- if .Values.adsTxt }} + volumeMounts: + - name: ads + mountPath: /usr/share/nginx/html/ads.txt + subPath: ads.txt + readOnly: true {{- end }} ports: - containerPort: {{ .Values.service.frontend.port }} resources: {{- toYaml .Values.resources.frontend | nindent 12 }} +{{- if .Values.adsTxt }} + volumes: + - name: ads + configMap: + name: {{ include "xslt-playground.fullname" . }}-ads + items: + - key: ads.txt + path: ads.txt +{{- end }} diff --git a/charts/xslt-playground/values.yaml b/charts/xslt-playground/values.yaml index 8841c40a..b0990e6f 100644 --- a/charts/xslt-playground/values.yaml +++ b/charts/xslt-playground/values.yaml @@ -63,3 +63,6 @@ frontend: # internal service URL when empty. backendUrl: "" +# Content for the optional ads.txt file served by the frontend +adsTxt: "" +