Files
mark_word_fastapi/kubernetes/fastapi-chart/templates/ingress.yaml
2025-07-07 09:26:04 +08:00

31 lines
1.0 KiB
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# kubernetes/fastapi-chart/templates/ingress.yaml
{{- if .Values.ingress.enabled -}}
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: {{ include "mark-word-fastapi.fullname" . }}
labels:
{{- include "mark-word-fastapi.labels" . | nindent 4 }}
annotations:
# 可以添加 Traefik 特定的 annotation例如强制重定向到 HTTPS
# traefik.ingress.kubernetes.io/router.entrypoints: web, websecure
# traefik.ingress.kubernetes.io/router.tls: "true"
# traefik.ingress.kubernetes.io/router.middlewares: default-redirect-https@kubernetescrd
spec:
ingressClassName: {{ .Values.ingress.className }}
rules:
- host: {{ .Values.ingress.host | quote }}
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: {{ include "mark-word-fastapi.fullname" . }}
port:
number: {{ .Values.service.port }}
{{- if .Values.ingress.tls }}
tls:
{{- toYaml .Values.ingress.tls | nindent 4 }}
{{- end }}
{{- end }}