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:
|
# Tower IngressRoute — path-based split between API and UI on the
|
||||||
# /api/* → backend (8080)
|
# same hostname.
|
||||||
# /* → frontend (when Step 4 builds it; currently a 503 from
|
|
||||||
# Traefik because backend.frontend.enabled=false)
|
|
||||||
#
|
#
|
||||||
# Once frontend lands, we add a second route block with a Path matcher
|
# Routing rules (Traefik picks longest-match-with-priority):
|
||||||
# for the `/api` prefix going to backend, and the catch-all for static
|
# - API endpoints (/healthz, /instances, future /api/*) → backend
|
||||||
# files going to frontend.
|
# - 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
|
apiVersion: traefik.io/v1alpha1
|
||||||
kind: IngressRoute
|
kind: IngressRoute
|
||||||
metadata:
|
metadata:
|
||||||
@@ -17,15 +19,15 @@ spec:
|
|||||||
- {{ .Values.ingress.entryPoint }}
|
- {{ .Values.ingress.entryPoint }}
|
||||||
routes:
|
routes:
|
||||||
{{- if .Values.backend.enabled }}
|
{{- if .Values.backend.enabled }}
|
||||||
- match: Host(`{{ .Values.ingress.domain }}`)
|
- match: Host(`{{ .Values.ingress.domain }}`) && (PathPrefix(`/healthz`) || PathPrefix(`/instances`) || PathPrefix(`/api`))
|
||||||
kind: Rule
|
kind: Rule
|
||||||
|
priority: 200
|
||||||
services:
|
services:
|
||||||
- name: tower-backend
|
- name: tower-backend
|
||||||
port: 8080
|
port: 8080
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- if .Values.frontend.enabled }}
|
{{- if .Values.frontend.enabled }}
|
||||||
# Frontend slot — enabled when Step 4 builds the UI.
|
- match: Host(`{{ .Values.ingress.domain }}`)
|
||||||
- match: Host(`{{ .Values.ingress.domain }}`) && !PathPrefix(`/api`) && !PathPrefix(`/healthz`) && !PathPrefix(`/instances`)
|
|
||||||
kind: Rule
|
kind: Rule
|
||||||
priority: 100
|
priority: 100
|
||||||
services:
|
services:
|
||||||
|
|||||||
14
values.yaml
14
values.yaml
@@ -4,7 +4,7 @@ backend:
|
|||||||
enabled: true
|
enabled: true
|
||||||
image:
|
image:
|
||||||
repository: docker.io/odoosky/tower
|
repository: docker.io/odoosky/tower
|
||||||
tag: "0.1.0"
|
tag: "0.2.0"
|
||||||
pullPolicy: IfNotPresent # IfNotPresent because the image is in
|
pullPolicy: IfNotPresent # IfNotPresent because the image is in
|
||||||
# containerd's k8s.io namespace already
|
# containerd's k8s.io namespace already
|
||||||
# (lab1 single-server). Replace with
|
# (lab1 single-server). Replace with
|
||||||
@@ -19,13 +19,19 @@ backend:
|
|||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
# Off until Step 4 builds it. The chart slot is reserved here so
|
enabled: true
|
||||||
# turning it on later is a values-flip, not a chart edit.
|
|
||||||
enabled: false
|
|
||||||
image:
|
image:
|
||||||
repository: docker.io/odoosky/tower-ui
|
repository: docker.io/odoosky/tower-ui
|
||||||
tag: "0.1.0"
|
tag: "0.1.0"
|
||||||
|
pullPolicy: IfNotPresent
|
||||||
replicas: 1
|
replicas: 1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 10m
|
||||||
|
memory: 16Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 64Mi
|
||||||
|
|
||||||
# Tower needs to talk to:
|
# Tower needs to talk to:
|
||||||
# - Gitea (create tenant repos, commit values.yaml)
|
# - Gitea (create tenant repos, commit values.yaml)
|
||||||
|
|||||||
Reference in New Issue
Block a user