Revert "update deploy yaml"

This reverts commit 9ffc73dd
This commit is contained in:
2025-07-07 10:55:33 +08:00
parent 5671b58af1
commit 15958a4185
7 changed files with 148 additions and 48 deletions

View File

@@ -1,5 +1,5 @@
apiVersion: v2
name: mark-word-fastapi
name: fastapi-k8s-app
description: A Helm chart for deploying FastAPI application on Kubernetes
version: 0.1.0 # Chart 版本
appVersion: "1.0.0" # 应用版本,通常与镜像版本关联

View File

@@ -1,7 +1,7 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "mark-word-fastapi.name" -}}
{{- define "fastapi-k8s-app.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}
@@ -10,7 +10,7 @@ Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "mark-word-fastapi.fullname" -}}
{{- define "fastapi-k8s-app.fullname" -}}
{{- if .Values.fullnameOverride }}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
@@ -26,16 +26,16 @@ If release name contains chart name it will be used as a full name.
{{/*
Create chart name and version as part of the label.
*/}}
{{- define "mark-word-fastapi.chart" -}}
{{- define "fastapi-k8s-app.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}
{{/*
Common labels
*/}}
{{- define "mark-word-fastapi.labels" -}}
helm.sh/chart: {{ include "mark-word-fastapi.chart" . }}
{{ include "mark-word-fastapi.selectorLabels" . }}
{{- define "fastapi-k8s-app.labels" -}}
helm.sh/chart: {{ include "fastapi-k8s-app.chart" . }}
{{ include "fastapi-k8s-app.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
@@ -45,7 +45,7 @@ app.kubernetes.io/managed-by: {{ .Release.Service }}
{{/*
Selector labels
*/}}
{{- define "mark-word-fastapi.selectorLabels" -}}
app.kubernetes.io/name: {{ include "mark-word-fastapi.name" . }}
{{- define "fastapi-k8s-app.selectorLabels" -}}
app.kubernetes.io/name: {{ include "fastapi-k8s-app.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

View File

@@ -1,18 +1,18 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "mark-word-fastapi.fullname" . }}
name: {{ include "fastapi-k8s-app.fullname" . }}
labels:
{{- include "mark-word-fastapi.labels" . | nindent 4 }}
{{- include "fastapi-k8s-app.labels" . | nindent 4 }}
spec:
replicas: {{ .Values.replicaCount }}
selector:
matchLabels:
{{- include "mark-word-fastapi.selectorLabels" . | nindent 6 }}
{{- include "fastapi-k8s-app.selectorLabels" . | nindent 6 }}
template:
metadata:
labels:
{{- include "mark-word-fastapi.selectorLabels" . | nindent 8 }}
{{- include "fastapi-k8s-app.selectorLabels" . | nindent 8 }}
spec:
containers:
- name: {{ .Chart.Name }}

View File

@@ -1,31 +0,0 @@
# 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 }}

View File

@@ -1,9 +1,9 @@
apiVersion: v1
kind: Service
metadata:
name: {{ include "mark-word-fastapi.fullname" . }}
name: {{ include "fastapi-k8s-app.fullname" . }}
labels:
{{- include "mark-word-fastapi.labels" . | nindent 4 }}
{{- include "fastapi-k8s-app.labels" . | nindent 4 }}
spec:
type: {{ .Values.service.type }}
ports:
@@ -12,4 +12,4 @@ spec:
protocol: TCP
name: http
selector:
{{- include "mark-word-fastapi.selectorLabels" . | nindent 4 }}
{{- include "fastapi-k8s-app.selectorLabels" . | nindent 4 }}

View File

@@ -17,4 +17,4 @@ ingress:
# tls:
# - hosts:
# - markword.simpla.dev
# secretName: fastapi-tls-secret # 你的TLS Secret名称
# secretName: fastapi-tls-secret # 你的TLS Secret名称