AirShelf/k8s/core/api-deployment.yaml
zyc d41e487f08
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 1m40s
feat(k8s): 新增 core 真应用(前端+Django API+Celery worker)构建与部署
- core/frontend: Vite 多阶段镜像 + nginx 同源反代 /api,/admin,/static(零 CORS)
- core/backend: Django gunicorn 镜像 + entrypoint(自动 migrate/collectstatic)+ WhiteNoise
- k8s/core: api/worker/web Deployment+Service + ingress(airshelf-web.airlabs.art)
- workflow: 追加 core 前后端 build/push,从 core/backend/.env 套生产覆盖生成 env Secret 后部署
- .gitignore 放行 core/backend/.env;.env 白名单加入 airshelf-web 域名
- 含前端 WIP 还原改动

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-05 10:21:41 +08:00

71 lines
1.7 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: airshelf-core-api
labels:
app: airshelf-core-api
spec:
replicas: 1
selector:
matchLabels:
app: airshelf-core-api
template:
metadata:
labels:
app: airshelf-core-api
spec:
imagePullSecrets:
- name: cr-pull-secret
containers:
- name: airshelf-core-api
image: ${CI_REGISTRY_IMAGE}/airshelf-core-api:latest
imagePullPolicy: Always
# No command override: the image ENTRYPOINT (docker-entrypoint.sh) runs
# migrate + collectstatic, then the default CMD (gunicorn) is exec'd.
ports:
- containerPort: 8000
envFrom:
- secretRef:
name: airshelf-core-env
livenessProbe:
httpGet:
path: /api/health/
port: 8000
httpHeaders:
- name: Host
value: airshelf-web.airlabs.art
initialDelaySeconds: 20
periodSeconds: 15
timeoutSeconds: 5
failureThreshold: 3
readinessProbe:
httpGet:
path: /api/health/
port: 8000
httpHeaders:
- name: Host
value: airshelf-web.airlabs.art
initialDelaySeconds: 10
periodSeconds: 10
timeoutSeconds: 5
failureThreshold: 3
resources:
requests:
memory: "256Mi"
cpu: "100m"
limits:
memory: "768Mi"
cpu: "1000m"
---
apiVersion: v1
kind: Service
metadata:
name: airshelf-core-api
spec:
selector:
app: airshelf-core-api
ports:
- protocol: TCP
port: 8000
targetPort: 8000