feat():learning后台管理前端页面初始化

This commit is contained in:
yuj
2025-12-04 17:51:24 +08:00
commit 83a614bd75
97 changed files with 23324 additions and 0 deletions

49
k8s/configmap.yaml Normal file
View File

@@ -0,0 +1,49 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: goalfymax-admin-web-config
namespace: goalfyagent
data:
nginx.conf: |
server {
listen 80;
server_name _;
# 前端静态文件根目录
root /usr/share/nginx/html;
index index.html index.htm;
# Gzip 压缩
gzip on;
gzip_vary on;
gzip_min_length 1024;
gzip_types text/plain text/css text/xml text/javascript application/x-javascript application/xml+rss application/json application/javascript;
# 前端路由支持SPA应用
location / {
try_files $uri $uri/ /index.html;
}
# 静态资源缓存
location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
expires 1y;
add_header Cache-Control "public, immutable";
try_files $uri =404;
}
# 健康检查接口
location /health {
access_log off;
return 200 "healthy\n";
add_header Content-Type text/plain;
}
# 安全头设置
add_header X-Frame-Options "SAMEORIGIN" always;
add_header X-Content-Type-Options "nosniff" always;
add_header X-XSS-Protection "1; mode=block" always;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# 隐藏 nginx 版本
server_tokens off;
}

58
k8s/deployment.yaml Normal file
View File

@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: goalfymax-admin-web
namespace: goalfyagent
labels:
app: goalfymax-admin-web
spec:
replicas: 2
selector:
matchLabels:
app: goalfymax-admin-web
template:
metadata:
labels:
app: goalfymax-admin-web
spec:
containers:
- name: goalfymax-admin-web
image: 177603749739.dkr.ecr.us-west-2.amazonaws.com/goalfy/goalfymax-admin-web:latest
imagePullPolicy: Always
ports:
- containerPort: 80
name: http
protocol: TCP
resources:
requests:
cpu: "50m"
memory: "64Mi"
limits:
cpu: "200m"
memory: "256Mi"
livenessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 3
failureThreshold: 3
readinessProbe:
httpGet:
path: /health
port: 80
initialDelaySeconds: 5
periodSeconds: 5
timeoutSeconds: 3
failureThreshold: 3
volumeMounts:
- name: nginx-config
mountPath: /etc/nginx/conf.d/default.conf
subPath: nginx.conf
readOnly: true
volumes:
- name: nginx-config
configMap:
name: goalfymax-admin-web-config
restartPolicy: Always

38
k8s/httproute.yaml Normal file
View File

@@ -0,0 +1,38 @@
apiVersion: gateway.networking.k8s.io/v1
kind: HTTPRoute
metadata:
name: goalfymax-admin-web-route
namespace: goalfyagent
labels:
app: goalfymax-admin-web
spec:
# 指定父级 Gateway
parentRefs:
- name: ingress-gateway
namespace: istio-system
# 配置主机名
hostnames:
- "goalfymax-admin.goalfyai.com"
# 路由规则
rules:
# 前端静态文件路由
- matches:
- path:
type: PathPrefix
value: /
backendRefs:
- name: goalfymax-admin-web
port: 80
weight: 100
# API 路由到后端服务
- matches:
- path:
type: PathPrefix
value: /api/
backendRefs:
- name: goalfymax-admin
port: 8087
weight: 100

16
k8s/service.yaml Normal file
View File

@@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: goalfymax-admin-web
namespace: goalfyagent
labels:
app: goalfymax-admin-web
spec:
type: ClusterIP
ports:
- port: 80
targetPort: 80
protocol: TCP
name: http
selector:
app: goalfymax-admin-web