From a4c164877c633e2de188cba6457f6f85bacd6170 Mon Sep 17 00:00:00 2001 From: chyoo Date: Tue, 14 Jul 2026 11:05:07 +0900 Subject: [PATCH] add ingress.. --- k8s/studio-manual-fe.yaml | 85 +++++++++++++++++++++++++++++++++++++++ src/App.tsx | 2 +- vite.config.ts | 4 +- 3 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 k8s/studio-manual-fe.yaml diff --git a/k8s/studio-manual-fe.yaml b/k8s/studio-manual-fe.yaml new file mode 100644 index 0000000..231fe1a --- /dev/null +++ b/k8s/studio-manual-fe.yaml @@ -0,0 +1,85 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: studio-manual-fe + namespace: studio-system + labels: + app: studio-manual-fe +spec: + replicas: 1 + selector: + matchLabels: + app: studio-manual-fe + template: + metadata: + labels: + app: studio-manual-fe + spec: + containers: + - name: studio-manual-fe + image: localhost:5000/studio-manual-fe:0.1.0 + imagePullPolicy: Always + ports: + - name: http + containerPort: 80 + resources: + requests: + cpu: 25m + memory: 32Mi + limits: + cpu: 200m + memory: 128Mi + readinessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 3 + periodSeconds: 10 + livenessProbe: + httpGet: + path: / + port: http + initialDelaySeconds: 10 + periodSeconds: 20 +--- +apiVersion: v1 +kind: Service +metadata: + name: studio-manual-fe + namespace: studio-system + labels: + app: studio-manual-fe +spec: + selector: + app: studio-manual-fe + ports: + - name: http + port: 80 + targetPort: http +--- +apiVersion: traefik.io/v1alpha1 +kind: Middleware +metadata: + name: studio-manual-fe-strip-prefix + namespace: studio-system +spec: + stripPrefix: + prefixes: + - /manual +--- +apiVersion: traefik.io/v1alpha1 +kind: IngressRoute +metadata: + name: studio-manual-fe + namespace: studio-system +spec: + entryPoints: + - web + routes: + - match: Host(`portal.autonomystudio.net`) && PathPrefix(`/manual`) + kind: Rule + middlewares: + - name: studio-manual-fe-strip-prefix + services: + - name: studio-manual-fe + port: 80 diff --git a/src/App.tsx b/src/App.tsx index 2380399..692c78f 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -15,7 +15,7 @@ type ManualResponse = { documents?: ManualDocument[] } -const API_BASE_URL = (import.meta.env.VITE_MANUAL_API_BASE_URL || '/api').replace(/\/+$/, '') +const API_BASE_URL = (import.meta.env.VITE_MANUAL_API_BASE_URL || `${import.meta.env.BASE_URL}api`).replace(/\/+$/, '') function App(): React.JSX.Element { const [documents, setDocuments] = useState([]) diff --git a/vite.config.ts b/vite.config.ts index 0778f70..0cb7bb6 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -2,12 +2,14 @@ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' export default defineConfig({ + base: '/manual/', plugins: [react()], server: { proxy: { - '/api': { + '/manual/api': { target: 'http://localhost:4500', changeOrigin: true, + rewrite: (path) => path.replace(/^\/manual/, ''), }, }, },