添加qiming-rcoder模块

This commit is contained in:
Codex
2026-06-01 13:54:52 +08:00
parent 8092c4b1f8
commit 4b1a580132
539 changed files with 151650 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
# ============================================================
# RCoder JuiceFS PVC
# 替代原来的 NFS PVC
# ============================================================
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: rcoder-workspace
namespace: nuwax-rcoder
labels:
app: rcoder
spec:
# ReadWriteMany: 支持 K8s 多节点同时读写 (JuiceFS 特性)
accessModes: ["ReadWriteMany"]
# storageClassName 由各环境 overlay 覆盖dev: juicefs-sc-dev, prod: juicefs-sc-prod
storageClassName: juicefs-sc-placeholder
resources:
requests:
storage: 50Gi

View File

@@ -0,0 +1,15 @@
# Storage layer - 存储层配置
# 注意:
# - juicefs-secret 由各环境 overlay 提供 (dev/prod)
# - juicefs-storageclass 由各环境 overlay 提供(集群级资源需按环境独立命名,避免冲突)
# - 不再使用 juicefs-init JobJuiceFS CSI driver 首次挂载时会用 Secret 里的
# name/metaurl/storage/bucket/access-key/secret-key 自动执行 formatJob 是冗余的
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- postgresql-deployment.yaml
- minio-deployment.yaml
- minio-init-job.yaml
- juicefs-pvc.yaml

View File

@@ -0,0 +1,112 @@
# ============================================================
# MinIO for JuiceFS Data Storage
# JuiceFS S3 兼容对象存储
# ============================================================
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: minio-pvc
namespace: nuwax-rcoder
labels:
app: minio
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "local-path" # 单节点环境使用 local-path
resources:
requests:
storage: 30Gi # 单节点环境使用较小存储
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: minio
namespace: nuwax-rcoder
spec:
serviceName: minio
replicas: 1
selector:
matchLabels:
app: minio
template:
metadata:
labels:
app: minio
spec:
containers:
- name: minio
image: minio/minio:latest
ports:
- containerPort: 9000
name: api
- containerPort: 9001
name: console
env:
- name: MINIO_ROOT_USER
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: MINIO_ROOT_USER
- name: MINIO_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: MINIO_ROOT_PASSWORD
args:
- server
- /data
- --console-address
- ":9001"
livenessProbe:
httpGet:
path: /minio/health/live
port: 9000
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
httpGet:
path: /minio/health/ready
port: 9000
initialDelaySeconds: 5
periodSeconds: 5
volumeMounts:
- name: minio-data
mountPath: /data
volumes:
- name: minio-data
persistentVolumeClaim:
claimName: minio-pvc
---
apiVersion: v1
kind: Service
metadata:
name: minio
namespace: nuwax-rcoder
spec:
selector:
app: minio
ports:
- name: api
port: 9000
targetPort: 9000
- name: console
port: 9001
targetPort: 9001
clusterIP: None # Headless service for StatefulSet
---
# Service for K8s internal access (ClusterIP)
apiVersion: v1
kind: Service
metadata:
name: minio-service
namespace: nuwax-rcoder
spec:
selector:
app: minio
ports:
- name: api
port: 9000
targetPort: 9000
- name: console
port: 9001
targetPort: 9001

View File

@@ -0,0 +1,47 @@
# ============================================================
# MinIO Bucket 初始化 Job
# 创建 JuiceFS 所需的 bucket
# ============================================================
apiVersion: batch/v1
kind: Job
metadata:
name: minio-init
namespace: nuwax-rcoder
spec:
ttlSecondsAfterFinished: 300 # Job 完成后 5 分钟自动清理
template:
spec:
restartPolicy: OnFailure
containers:
- name: mc
image: minio/mc:latest
command:
- /bin/sh
- -c
- |
# 等待 MinIO 就绪
echo "Waiting for MinIO to be ready..."
until mc alias set myminio http://minio:9000 ${MINIO_ROOT_USER} ${MINIO_ROOT_PASSWORD}; do
echo "MinIO not ready, retrying..."
sleep 2
done
echo "MinIO is ready, creating bucket..."
# 创建 JuiceFS 专用 bucket
mc mb myminio/juicefs --ignore-existing
# 验证
mc ls myminio/
echo "MinIO initialization completed!"
env:
- name: MINIO_ROOT_USER
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: MINIO_ROOT_USER
- name: MINIO_ROOT_PASSWORD
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: MINIO_ROOT_PASSWORD

View File

@@ -0,0 +1,97 @@
# ============================================================
# PostgreSQL for JuiceFS Metadata
# JuiceFS 元数据存储
# ============================================================
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: postgresql-pvc
namespace: nuwax-rcoder
labels:
app: postgresql
spec:
accessModes: ["ReadWriteOnce"]
storageClassName: "local-path" # 单节点环境使用 local-path
resources:
requests:
storage: 10Gi
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: postgresql
namespace: nuwax-rcoder
spec:
serviceName: postgresql
replicas: 1
selector:
matchLabels:
app: postgresql
template:
metadata:
labels:
app: postgresql
spec:
initContainers:
- name: cleanup
image: postgres:16-alpine
command: ["rm", "-rf", "/var/lib/postgresql/data/lost+found"]
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
containers:
- name: postgresql
image: postgres:16-alpine
ports:
- containerPort: 5432
name: postgres
env:
- name: POSTGRES_DB
value: "juicefs"
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: POSTGRES_USER
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: rcoder-credentials
key: POSTGRES_PASSWORD
livenessProbe:
exec:
command:
- pg_isready
- -U
- juicefs
initialDelaySeconds: 30
periodSeconds: 10
readinessProbe:
exec:
command:
- pg_isready
- -U
- juicefs
initialDelaySeconds: 5
periodSeconds: 5
volumeMounts:
- name: postgres-data
mountPath: /var/lib/postgresql/data
volumes:
- name: postgres-data
persistentVolumeClaim:
claimName: postgresql-pvc
---
apiVersion: v1
kind: Service
metadata:
name: postgresql
namespace: nuwax-rcoder
spec:
selector:
app: postgresql
ports:
- name: postgres
port: 5432
targetPort: 5432