Step 4: enable frontend + path-based routing + tower:0.2.0
This commit is contained in:
42
templates/frontend-deployment.yaml
Normal file
42
templates/frontend-deployment.yaml
Normal file
@@ -0,0 +1,42 @@
|
||||
{{- if .Values.frontend.enabled -}}
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: tower-frontend
|
||||
labels:
|
||||
{{- include "tower.labels" . | nindent 4 }}
|
||||
odoosky.io/role: frontend
|
||||
spec:
|
||||
replicas: {{ .Values.frontend.replicas }}
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: tower
|
||||
odoosky.io/role: frontend
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
{{- include "tower.labels" . | nindent 8 }}
|
||||
odoosky.io/role: frontend
|
||||
spec:
|
||||
containers:
|
||||
- name: tower-ui
|
||||
image: "{{ .Values.frontend.image.repository }}:{{ .Values.frontend.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.frontend.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 2
|
||||
periodSeconds: 5
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 15
|
||||
resources:
|
||||
{{- toYaml .Values.frontend.resources | nindent 12 }}
|
||||
{{- end }}
|
||||
17
templates/frontend-service.yaml
Normal file
17
templates/frontend-service.yaml
Normal file
@@ -0,0 +1,17 @@
|
||||
{{- if .Values.frontend.enabled -}}
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: tower-frontend
|
||||
labels:
|
||||
{{- include "tower.labels" . | nindent 4 }}
|
||||
spec:
|
||||
selector:
|
||||
app.kubernetes.io/name: tower
|
||||
odoosky.io/role: frontend
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: 80
|
||||
type: ClusterIP
|
||||
{{- end }}
|
||||
@@ -1,11 +1,13 @@
|
||||
# Tower IngressRoute. Routes by path:
|
||||
# /api/* → backend (8080)
|
||||
# /* → frontend (when Step 4 builds it; currently a 503 from
|
||||
# Traefik because backend.frontend.enabled=false)
|
||||
# Tower IngressRoute — path-based split between API and UI on the
|
||||
# same hostname.
|
||||
#
|
||||
# Once frontend lands, we add a second route block with a Path matcher
|
||||
# for the `/api` prefix going to backend, and the catch-all for static
|
||||
# files going to frontend.
|
||||
# Routing rules (Traefik picks longest-match-with-priority):
|
||||
# - API endpoints (/healthz, /instances, future /api/*) → backend
|
||||
# - everything else → frontend (Vue SPA)
|
||||
#
|
||||
# Priority is set explicitly so Traefik doesn't fall back to its
|
||||
# heuristic; the API rule outranks the catchall, which outranks no
|
||||
# rule at all.
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
@@ -17,15 +19,15 @@ spec:
|
||||
- {{ .Values.ingress.entryPoint }}
|
||||
routes:
|
||||
{{- if .Values.backend.enabled }}
|
||||
- match: Host(`{{ .Values.ingress.domain }}`)
|
||||
- match: Host(`{{ .Values.ingress.domain }}`) && (PathPrefix(`/healthz`) || PathPrefix(`/instances`) || PathPrefix(`/api`))
|
||||
kind: Rule
|
||||
priority: 200
|
||||
services:
|
||||
- name: tower-backend
|
||||
port: 8080
|
||||
{{- end }}
|
||||
{{- if .Values.frontend.enabled }}
|
||||
# Frontend slot — enabled when Step 4 builds the UI.
|
||||
- match: Host(`{{ .Values.ingress.domain }}`) && !PathPrefix(`/api`) && !PathPrefix(`/healthz`) && !PathPrefix(`/instances`)
|
||||
- match: Host(`{{ .Values.ingress.domain }}`)
|
||||
kind: Rule
|
||||
priority: 100
|
||||
services:
|
||||
|
||||
14
values.yaml
14
values.yaml
@@ -4,7 +4,7 @@ backend:
|
||||
enabled: true
|
||||
image:
|
||||
repository: docker.io/odoosky/tower
|
||||
tag: "0.1.0"
|
||||
tag: "0.2.0"
|
||||
pullPolicy: IfNotPresent # IfNotPresent because the image is in
|
||||
# containerd's k8s.io namespace already
|
||||
# (lab1 single-server). Replace with
|
||||
@@ -19,13 +19,19 @@ backend:
|
||||
memory: 256Mi
|
||||
|
||||
frontend:
|
||||
# Off until Step 4 builds it. The chart slot is reserved here so
|
||||
# turning it on later is a values-flip, not a chart edit.
|
||||
enabled: false
|
||||
enabled: true
|
||||
image:
|
||||
repository: docker.io/odoosky/tower-ui
|
||||
tag: "0.1.0"
|
||||
pullPolicy: IfNotPresent
|
||||
replicas: 1
|
||||
resources:
|
||||
requests:
|
||||
cpu: 10m
|
||||
memory: 16Mi
|
||||
limits:
|
||||
cpu: 250m
|
||||
memory: 64Mi
|
||||
|
||||
# Tower needs to talk to:
|
||||
# - Gitea (create tenant repos, commit values.yaml)
|
||||
|
||||
Reference in New Issue
Block a user