Update ingress in my-recipes
This commit is contained in:
parent
06e1d637b0
commit
8da895d76f
@ -25,26 +25,13 @@ spec:
|
|||||||
- containerPort: {{ .Values.frontend.service.targetPort }}
|
- containerPort: {{ .Values.frontend.service.targetPort }}
|
||||||
name: http
|
name: http
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
{{- /* compute API_BASE: prefer frontend.env.API_BASE, else use first ingress host */}}
|
{{- with .Values.frontend.env }}
|
||||||
{{- $apiBase := "" }}
|
|
||||||
{{- if .Values.frontend.env.API_BASE }}
|
|
||||||
{{- $apiBase = .Values.frontend.env.API_BASE }}
|
|
||||||
{{- else if .Values.ingress.hosts }}
|
|
||||||
{{- $firstHost := index .Values.ingress.hosts 0 }}
|
|
||||||
{{- $apiBase = printf "https://%s/api" $firstHost.host }}
|
|
||||||
{{- end }}
|
|
||||||
env:
|
env:
|
||||||
- name: API_BASE
|
|
||||||
value: {{ $apiBase | quote }}
|
|
||||||
{{- /* include any other env vars provided in values.frontend.env (skip API_BASE to avoid duplicate) */}}
|
|
||||||
{{- with .Values.frontend.env }}
|
|
||||||
{{- range $key, $value := . }}
|
{{- range $key, $value := . }}
|
||||||
{{- if ne $key "API_BASE" }}
|
|
||||||
- name: {{ $key }}
|
- name: {{ $key }}
|
||||||
value: {{ $value | quote }}
|
value: {{ $value | quote }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
|
||||||
livenessProbe:
|
livenessProbe:
|
||||||
httpGet:
|
httpGet:
|
||||||
path: /
|
path: /
|
||||||
|
|||||||
@ -1,31 +1,22 @@
|
|||||||
{{- if .Values.ingress.enabled }}
|
{{- if .Values.frontend.ingress.enabled }}
|
||||||
apiVersion: networking.k8s.io/v1
|
apiVersion: networking.k8s.io/v1
|
||||||
kind: Ingress
|
kind: Ingress
|
||||||
metadata:
|
metadata:
|
||||||
name: {{ .Release.Name }}
|
name: {{ .Release.Name }}-frontend
|
||||||
namespace: {{ .Values.global.namespace }}
|
namespace: {{ .Values.global.namespace }}
|
||||||
labels:
|
labels:
|
||||||
app: {{ .Release.Name }}
|
app: {{ .Release.Name }}-frontend
|
||||||
{{- with .Values.ingress.annotations }}
|
component: frontend
|
||||||
|
{{- with .Values.frontend.ingress.annotations }}
|
||||||
annotations:
|
annotations:
|
||||||
{{- toYaml . | nindent 4 }}
|
{{- toYaml . | nindent 4 }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
spec:
|
spec:
|
||||||
{{- if .Values.ingress.className }}
|
{{- if .Values.frontend.ingress.className }}
|
||||||
ingressClassName: {{ .Values.ingress.className }}
|
ingressClassName: {{ .Values.frontend.ingress.className }}
|
||||||
{{- end }}
|
|
||||||
{{- if .Values.ingress.tls }}
|
|
||||||
tls:
|
|
||||||
{{- range .Values.ingress.tls }}
|
|
||||||
- hosts:
|
|
||||||
{{- range .hosts }}
|
|
||||||
- {{ . | quote }}
|
|
||||||
{{- end }}
|
|
||||||
secretName: {{ .secretName }}
|
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
rules:
|
rules:
|
||||||
{{- range .Values.ingress.hosts }}
|
{{- range .Values.frontend.ingress.hosts }}
|
||||||
- host: {{ .host | quote }}
|
- host: {{ .host | quote }}
|
||||||
http:
|
http:
|
||||||
paths:
|
paths:
|
||||||
@ -34,15 +25,65 @@ spec:
|
|||||||
pathType: {{ .pathType }}
|
pathType: {{ .pathType }}
|
||||||
backend:
|
backend:
|
||||||
service:
|
service:
|
||||||
{{- if eq .backend "frontend" }}
|
|
||||||
name: {{ $.Release.Name }}-{{ $.Values.frontend.name }}
|
name: {{ $.Release.Name }}-{{ $.Values.frontend.name }}
|
||||||
port:
|
port:
|
||||||
number: {{ $.Values.frontend.service.port }}
|
number: {{ $.Values.frontend.service.port }}
|
||||||
{{- else if eq .backend "backend" }}
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- if .Values.frontend.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.frontend.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
{{- if .Values.backend.ingress.enabled }}
|
||||||
|
apiVersion: networking.k8s.io/v1
|
||||||
|
kind: Ingress
|
||||||
|
metadata:
|
||||||
|
name: {{ .Release.Name }}-backend
|
||||||
|
namespace: {{ .Values.global.namespace }}
|
||||||
|
labels:
|
||||||
|
app: {{ .Release.Name }}-backend
|
||||||
|
component: backend
|
||||||
|
{{- with .Values.backend.ingress.annotations }}
|
||||||
|
annotations:
|
||||||
|
{{- toYaml . | nindent 4 }}
|
||||||
|
{{- end }}
|
||||||
|
spec:
|
||||||
|
{{- if .Values.backend.ingress.className }}
|
||||||
|
ingressClassName: {{ .Values.backend.ingress.className }}
|
||||||
|
{{- end }}
|
||||||
|
rules:
|
||||||
|
{{- range .Values.backend.ingress.hosts }}
|
||||||
|
- host: {{ .host | quote }}
|
||||||
|
http:
|
||||||
|
paths:
|
||||||
|
{{- range .paths }}
|
||||||
|
- path: {{ .path }}
|
||||||
|
pathType: {{ .pathType }}
|
||||||
|
backend:
|
||||||
|
service:
|
||||||
name: {{ $.Release.Name }}-{{ $.Values.backend.name }}
|
name: {{ $.Release.Name }}-{{ $.Values.backend.name }}
|
||||||
port:
|
port:
|
||||||
number: {{ $.Values.backend.service.port }}
|
number: {{ $.Values.backend.service.port }}
|
||||||
{{- end }}
|
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
{{- if .Values.backend.ingress.tls }}
|
||||||
|
tls:
|
||||||
|
{{- range .Values.backend.ingress.tls }}
|
||||||
|
- hosts:
|
||||||
|
{{- range .hosts }}
|
||||||
|
- {{ . | quote }}
|
||||||
|
{{- end }}
|
||||||
|
secretName: {{ .secretName }}
|
||||||
|
{{- end }}
|
||||||
|
{{- end }}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|||||||
@ -27,6 +27,17 @@ backend:
|
|||||||
env:
|
env:
|
||||||
PYTHONUNBUFFERED: "1"
|
PYTHONUNBUFFERED: "1"
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: "nginx"
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
hosts:
|
||||||
|
- host: api-my-recipes.dvirlabs.com
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
|
||||||
# Frontend configuration
|
# Frontend configuration
|
||||||
frontend:
|
frontend:
|
||||||
name: frontend
|
name: frontend
|
||||||
@ -38,11 +49,11 @@ frontend:
|
|||||||
|
|
||||||
service:
|
service:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
port: 3000
|
port: 80
|
||||||
targetPort: 3000
|
targetPort: 80
|
||||||
|
|
||||||
env:
|
env:
|
||||||
API_BASE: "https://my-recipes.dvirlabs.com/api"
|
API_BASE: "https://api-my-recipes.dvirlabs.com"
|
||||||
|
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
@ -52,6 +63,17 @@ frontend:
|
|||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
|
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: "nginx"
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
hosts:
|
||||||
|
- host: my-recipes.dvirlabs.com
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
|
|
||||||
# PostgreSQL configuration
|
# PostgreSQL configuration
|
||||||
postgres:
|
postgres:
|
||||||
name: db
|
name: db
|
||||||
@ -86,22 +108,16 @@ postgres:
|
|||||||
|
|
||||||
# Ingress configuration
|
# Ingress configuration
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: false # Individual frontend/backend ingress resources handle routing instead
|
||||||
className: "nginx"
|
className: "nginx"
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: "/$2"
|
|
||||||
nginx.ingress.kubernetes.io/use-regex: "true"
|
|
||||||
hosts:
|
hosts:
|
||||||
- host: my-recipes.dvirlabs.com
|
- host: my-recipes.dvirlabs.com
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend: frontend
|
backend: frontend
|
||||||
# use a regex to capture and rewrite /api/... to /... on the backend
|
|
||||||
- path: /api(/|$)(.*)
|
|
||||||
pathType: ImplementationSpecific
|
|
||||||
backend: backend
|
|
||||||
tls:
|
tls:
|
||||||
- secretName: recipes-tls
|
- secretName: recipes-tls
|
||||||
hosts:
|
hosts:
|
||||||
|
|||||||
@ -23,6 +23,16 @@ backend:
|
|||||||
env:
|
env:
|
||||||
PYTHONUNBUFFERED: "1"
|
PYTHONUNBUFFERED: "1"
|
||||||
tag: master-895786b
|
tag: master-895786b
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: "nginx"
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
hosts:
|
||||||
|
- host: api-my-recipes.dvirlabs.com
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
# Frontend configuration
|
# Frontend configuration
|
||||||
frontend:
|
frontend:
|
||||||
name: frontend
|
name: frontend
|
||||||
@ -33,10 +43,10 @@ frontend:
|
|||||||
tag: "master-895786b"
|
tag: "master-895786b"
|
||||||
service:
|
service:
|
||||||
type: ClusterIP
|
type: ClusterIP
|
||||||
port: 3000
|
port: 80
|
||||||
targetPort: 3000
|
targetPort: 80
|
||||||
env:
|
env:
|
||||||
API_BASE: "https://my-recipes.dvirlabs.com/api"
|
API_BASE: "https://api-my-recipes.dvirlabs.com"
|
||||||
resources:
|
resources:
|
||||||
requests:
|
requests:
|
||||||
cpu: 50m
|
cpu: 50m
|
||||||
@ -44,7 +54,17 @@ frontend:
|
|||||||
limits:
|
limits:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 256Mi
|
memory: 256Mi
|
||||||
tag: master-88ec058
|
tag: master-bd31ffb
|
||||||
|
ingress:
|
||||||
|
enabled: true
|
||||||
|
className: "nginx"
|
||||||
|
annotations:
|
||||||
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
|
hosts:
|
||||||
|
- host: my-recipes.dvirlabs.com
|
||||||
|
paths:
|
||||||
|
- path: /
|
||||||
|
pathType: Prefix
|
||||||
# PostgreSQL configuration
|
# PostgreSQL configuration
|
||||||
postgres:
|
postgres:
|
||||||
name: db
|
name: db
|
||||||
@ -72,24 +92,18 @@ postgres:
|
|||||||
limits:
|
limits:
|
||||||
cpu: 1000m
|
cpu: 1000m
|
||||||
memory: 1Gi
|
memory: 1Gi
|
||||||
# Ingress (top-level, maps frontend/backend paths)
|
# Ingress (top-level, disabled - use component-specific ingress instead)
|
||||||
ingress:
|
ingress:
|
||||||
enabled: true
|
enabled: false
|
||||||
className: "nginx"
|
className: "nginx"
|
||||||
annotations:
|
annotations:
|
||||||
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
cert-manager.io/cluster-issuer: "letsencrypt-prod"
|
||||||
nginx.ingress.kubernetes.io/rewrite-target: "/$2"
|
|
||||||
nginx.ingress.kubernetes.io/use-regex: "true"
|
|
||||||
hosts:
|
hosts:
|
||||||
- host: my-recipes.dvirlabs.com
|
- host: my-recipes.dvirlabs.com
|
||||||
paths:
|
paths:
|
||||||
- path: /
|
- path: /
|
||||||
pathType: Prefix
|
pathType: Prefix
|
||||||
backend: frontend
|
backend: frontend
|
||||||
# use a regex to capture and rewrite /api/... to /... on the backend
|
|
||||||
- path: /api(/|$)(.*)
|
|
||||||
pathType: ImplementationSpecific
|
|
||||||
backend: backend
|
|
||||||
tls:
|
tls:
|
||||||
- secretName: recipes-tls
|
- secretName: recipes-tls
|
||||||
hosts:
|
hosts:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user