diff --git a/.github/workflows/build-push-gcloud.yaml b/.github/workflows/build-push-gcloud.yaml index 048564ff..e8278849 100644 --- a/.github/workflows/build-push-gcloud.yaml +++ b/.github/workflows/build-push-gcloud.yaml @@ -70,5 +70,7 @@ jobs: push: true labels: | ci.run_id=${{ github.run_id }} + build-args: + - VITE_GRPC_BACKEND="${{ vars.VITE_GRPC_BACKEND }}" tags: | ${{ inputs.registry }}/${{ secrets.GCLOUD_PROJECT }}/${{ inputs.repo }}:${{ steps.vars.outputs.branch }}-${{ steps.vars.outputs.sha_short }} diff --git a/frontend.Dockerfile b/frontend.Dockerfile index 3e7099d8..f25a4dae 100644 --- a/frontend.Dockerfile +++ b/frontend.Dockerfile @@ -13,6 +13,8 @@ RUN yarn protoc \ --ts_opt ts_nocheck \ ./protos/*.proto +ARG VITE_GRPC_BACKEND="http://0.0.0.0:8080" +ENV VITE_GRPC_BACKEND=${VITE_GRPC_BACKEND} RUN yarn build FROM flashspys/nginx-static:latest AS app diff --git a/iac/gitops/frontend/deployment.yaml b/iac/gitops/frontend/deployment.yaml index fd0cedbe..3553bb83 100644 --- a/iac/gitops/frontend/deployment.yaml +++ b/iac/gitops/frontend/deployment.yaml @@ -9,6 +9,9 @@ spec: containers: - name: frontend image: frontend:latest + env: + - name: VITE_GRPC_BACKEND + value: "https://whisper-notes-backend.polynomial.finance" ports: - name: http containerPort: 80 diff --git a/iac/gitops/frontend/ingress.yaml b/iac/gitops/frontend/ingress.yaml new file mode 100644 index 00000000..22703e52 --- /dev/null +++ b/iac/gitops/frontend/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: rt-frontend +spec: + hostnames: + - whisper-notes.polynomial.finance + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: public-istio-gateway + namespace: default + rules: + - backendRefs: + - group: '' + kind: Service + name: whisper-notes-frontend + port: 80 + weight: 1 + matches: + - path: + type: PathPrefix + value: / diff --git a/iac/gitops/frontend/kustomization.yaml b/iac/gitops/frontend/kustomization.yaml index e6ffc4fe..a21e537a 100644 --- a/iac/gitops/frontend/kustomization.yaml +++ b/iac/gitops/frontend/kustomization.yaml @@ -4,6 +4,7 @@ kind: Kustomization resources: - deployment.yaml - service.yaml + - ingress.yaml namePrefix: whisper-notes- namespace: debug # CHANGEME: default diff --git a/iac/gitops/proxy/ingress.yaml b/iac/gitops/proxy/ingress.yaml new file mode 100644 index 00000000..f7c2dc81 --- /dev/null +++ b/iac/gitops/proxy/ingress.yaml @@ -0,0 +1,23 @@ +apiVersion: gateway.networking.k8s.io/v1beta1 +kind: HTTPRoute +metadata: + name: rt-api-proxy +spec: + hostnames: + - whisper-notes-backend.polynomial.finance + parentRefs: + - group: gateway.networking.k8s.io + kind: Gateway + name: public-istio-gateway + namespace: default + rules: + - backendRefs: + - group: '' + kind: Service + name: whisper-notes-proxy + port: 8443 + weight: 1 + matches: + - path: + type: PathPrefix + value: / diff --git a/iac/gitops/proxy/kustomization.yaml b/iac/gitops/proxy/kustomization.yaml index 8c31eae5..c8f17593 100644 --- a/iac/gitops/proxy/kustomization.yaml +++ b/iac/gitops/proxy/kustomization.yaml @@ -4,6 +4,7 @@ kind: Kustomization resources: - deployment.yaml - service.yaml + - ingress.yaml namePrefix: whisper-notes- namespace: debug # CHANGEME: default