fix: use nginx for app
This commit is contained in:
@@ -1,37 +1,39 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
apiVersion: traefik.io/v1alpha1
|
||||
kind: IngressRoute
|
||||
metadata:
|
||||
name: {{ include "memevault.fullname" . }}
|
||||
labels:
|
||||
{{- include "memevault.labels" . | nindent 4 }}
|
||||
{{- with .Values.ingress.annotations }}
|
||||
annotations:
|
||||
{{- toYaml . | nindent 4 }}
|
||||
{{- end }}
|
||||
spec:
|
||||
entryPoints:
|
||||
{{- toYaml .Values.ingress.entryPoints | nindent 4 }}
|
||||
routes:
|
||||
# API-запросы идут напрямую в api-сервис.
|
||||
- match: Host(`{{ .Values.ingress.host }}`) && PathPrefix(`/api`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: {{ include "memevault.fullname" . }}-api
|
||||
port: 8080
|
||||
# Всё остальное — miniapp (Svelte SPA + nginx).
|
||||
- match: Host(`{{ .Values.ingress.host }}`)
|
||||
kind: Rule
|
||||
services:
|
||||
- name: {{ include "memevault.fullname" . }}-miniapp
|
||||
port: 80
|
||||
{{- if .Values.ingress.tls.enabled }}
|
||||
tls:
|
||||
- hosts:
|
||||
- {{ .Values.ingress.host }}
|
||||
secretName: {{ .Values.ingress.tls.secretName }}
|
||||
{{- if .Values.ingress.tls.certResolver }}
|
||||
# ACME-резолвер (Let's Encrypt и т.п.) — Traefik сам получает сертификат.
|
||||
certResolver: {{ .Values.ingress.tls.certResolver }}
|
||||
{{- else if .Values.ingress.tls.store }}
|
||||
# TLSStore из произвольного неймспейса (требует allowCrossNamespace=true).
|
||||
store:
|
||||
name: {{ .Values.ingress.tls.store.name }}
|
||||
{{- if .Values.ingress.tls.store.namespace }}
|
||||
namespace: {{ .Values.ingress.tls.store.namespace }}
|
||||
{{- end }}
|
||||
{{- else if .Values.ingress.tls.secretName }}
|
||||
# Секрет в том же неймспейсе.
|
||||
secretName: {{ .Values.ingress.tls.secretName }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
rules:
|
||||
- host: {{ .Values.ingress.host }}
|
||||
http:
|
||||
paths:
|
||||
# API-запросы идут напрямую в api-сервис, минуя miniapp nginx.
|
||||
- path: /api
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "memevault.fullname" . }}-api
|
||||
port:
|
||||
name: http
|
||||
# Всё остальное — miniapp (Svelte SPA + nginx).
|
||||
- path: /
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: {{ include "memevault.fullname" . }}-miniapp
|
||||
port:
|
||||
name: http
|
||||
|
||||
Reference in New Issue
Block a user