From 727495f7c1102a12a0085f7d5d65aeabca4075b0 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Fri, 6 Jun 2025 17:11:32 +0300 Subject: [PATCH] Add init container and cm for front --- navix-helm/templates/frontend-deployment.yaml | 27 ++++++++++++++++--- .../templates/frontend-env-configmap.yaml | 9 +++++++ 2 files changed, 33 insertions(+), 3 deletions(-) create mode 100644 navix-helm/templates/frontend-env-configmap.yaml diff --git a/navix-helm/templates/frontend-deployment.yaml b/navix-helm/templates/frontend-deployment.yaml index 203a5f5..4c5725d 100644 --- a/navix-helm/templates/frontend-deployment.yaml +++ b/navix-helm/templates/frontend-deployment.yaml @@ -12,12 +12,33 @@ spec: labels: app: navix-frontend spec: + initContainers: + - name: copy-env + image: busybox + command: ["sh", "-c", "cp /config/env.js /env/env.js"] + volumeMounts: + - name: env-config + mountPath: /config + - name: env-volume + mountPath: /env + containers: - name: frontend image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}" imagePullPolicy: {{ .Values.frontend.image.pullPolicy }} ports: - containerPort: 80 - env: - - name: VITE_API_URL - value: "http://navix-backend.{{ .Release.Namespace }}.svc.cluster.local:8000" + volumeMounts: + - name: env-volume + mountPath: /usr/share/nginx/html/env.js + subPath: env.js + + volumes: + - name: env-volume + emptyDir: {} + - name: env-config + configMap: + name: navix-frontend-env + items: + - key: env.js + path: env.js diff --git a/navix-helm/templates/frontend-env-configmap.yaml b/navix-helm/templates/frontend-env-configmap.yaml new file mode 100644 index 0000000..75e69c9 --- /dev/null +++ b/navix-helm/templates/frontend-env-configmap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: navix-frontend-env +data: + env.js: | + window.env = { + VITE_API_URL: "http://navix-backend.{{ .Release.Namespace }}.svc.cluster.local:8000" + };