From 6a78e9068164b8c424a09fea115b03b447455f68 Mon Sep 17 00:00:00 2001 From: dvirlabs Date: Fri, 6 Jun 2025 18:34:17 +0300 Subject: [PATCH] Change front and back tag and the chart --- .../navix-helm/templates/backend-ingress.yaml | 23 ++++++++++++++++ .../templates/frontend-deployment.yaml | 27 ++++++++++++++++--- .../templates/frontend-env-configmap.yaml | 9 +++++++ charts/navix-helm/values.yaml | 13 ++++++++- manifests/navix/values.yaml | 17 +++++++++--- 5 files changed, 82 insertions(+), 7 deletions(-) create mode 100644 charts/navix-helm/templates/backend-ingress.yaml create mode 100644 charts/navix-helm/templates/frontend-env-configmap.yaml diff --git a/charts/navix-helm/templates/backend-ingress.yaml b/charts/navix-helm/templates/backend-ingress.yaml new file mode 100644 index 0000000..02fa268 --- /dev/null +++ b/charts/navix-helm/templates/backend-ingress.yaml @@ -0,0 +1,23 @@ +{{- if .Values.backend.ingress.enabled }} +apiVersion: networking.k8s.io/v1 +kind: Ingress +metadata: + name: navix-backend + annotations: + {{- range $key, $value := .Values.backend.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + ingressClassName: {{ .Values.backend.ingress.className }} + rules: + - host: {{ .Values.backend.ingress.hosts[0].host }} + http: + paths: + - path: /api + pathType: Prefix + backend: + service: + name: navix-backend + port: + number: {{ .Values.backend.service.port }} +{{- end }} diff --git a/charts/navix-helm/templates/frontend-deployment.yaml b/charts/navix-helm/templates/frontend-deployment.yaml index 203a5f5..4c5725d 100644 --- a/charts/navix-helm/templates/frontend-deployment.yaml +++ b/charts/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/charts/navix-helm/templates/frontend-env-configmap.yaml b/charts/navix-helm/templates/frontend-env-configmap.yaml new file mode 100644 index 0000000..a4faaf6 --- /dev/null +++ b/charts/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: "{{ .Values.frontend.env.VITE_API_URL }}" + }; diff --git a/charts/navix-helm/values.yaml b/charts/navix-helm/values.yaml index a4f148e..f97bd25 100644 --- a/charts/navix-helm/values.yaml +++ b/charts/navix-helm/values.yaml @@ -17,6 +17,8 @@ frontend: paths: - path: / pathType: Prefix + env: + VITE_API_URL: "/api" backend: image: @@ -32,4 +34,13 @@ backend: MINIO_ENDPOINT: "s3.dvirlabs.com" MINIO_BUCKET: "navix-icons" ingress: - enabled: false \ No newline at end of file + enabled: true + className: traefik + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + hosts: + - host: navix.dvirlabs.com + paths: + - path: /api + pathType: Prefix diff --git a/manifests/navix/values.yaml b/manifests/navix/values.yaml index 6f7d2e9..9a3d847 100644 --- a/manifests/navix/values.yaml +++ b/manifests/navix/values.yaml @@ -1,7 +1,7 @@ frontend: image: repository: harbor.dvirlabs.com/my-apps/navix-front - tag: v6-no-cicd + tag: latest pullPolicy: IfNotPresent service: type: ClusterIP @@ -17,11 +17,13 @@ frontend: paths: - path: / pathType: Prefix + env: + VITE_API_URL: "/api" backend: image: repository: harbor.dvirlabs.com/my-apps/navix-back - tag: v2-no-cicd + tag: latest pullPolicy: IfNotPresent service: type: ClusterIP @@ -32,4 +34,13 @@ backend: MINIO_ENDPOINT: "s3.dvirlabs.com" MINIO_BUCKET: "navix-icons" ingress: - enabled: false \ No newline at end of file + enabled: true + className: traefik + annotations: + traefik.ingress.kubernetes.io/router.entrypoints: websecure + traefik.ingress.kubernetes.io/router.tls: "true" + hosts: + - host: navix.dvirlabs.com + paths: + - path: /api + pathType: Prefix