fix: use nginx for app
This commit is contained in:
@@ -18,12 +18,15 @@ spec:
|
||||
app.kubernetes.io/component: miniapp
|
||||
spec:
|
||||
containers:
|
||||
- name: miniapp
|
||||
image: "{{ .Values.miniapp.image.registry }}/{{ .Values.miniapp.image.repository }}:{{ .Values.miniapp.image.tag | default .Chart.Version }}"
|
||||
imagePullPolicy: {{ .Values.miniapp.image.pullPolicy }}
|
||||
- name: nginx
|
||||
image: "{{ .Values.miniapp.nginx.image.registry }}/{{ .Values.miniapp.nginx.image.repository }}:{{ .Values.miniapp.nginx.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.miniapp.nginx.image.pullPolicy }}
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 80
|
||||
volumeMounts:
|
||||
- name: webroot
|
||||
mountPath: /usr/share/nginx/html
|
||||
resources:
|
||||
{{- toYaml .Values.miniapp.resources | nindent 12 }}
|
||||
readinessProbe:
|
||||
@@ -38,3 +41,8 @@ spec:
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 20
|
||||
volumes:
|
||||
- name: webroot
|
||||
image:
|
||||
reference: "{{ .Values.miniapp.image.registry }}/{{ .Values.miniapp.image.repository }}:{{ .Values.miniapp.image.tag | default .Chart.Version }}"
|
||||
pullPolicy: {{ .Values.miniapp.image.pullPolicy }}
|
||||
|
||||
@@ -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