feat: centralized K8s infra — dev/prod environments
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: lpt-config
|
||||
namespace: lpt-dev
|
||||
data:
|
||||
# LPT AI Service
|
||||
LLM_API_URL: https://api.siliconflow.cn/v1/chat/completions
|
||||
LLM_MODEL: Qwen/Qwen2.5-32B-Instruct
|
||||
LLM_TIMEOUT_MS: "60000"
|
||||
LPT_AI-SERVICE_URL: http://lpt-ai:5199
|
||||
PORT: "5199"
|
||||
|
||||
# Spring Boot Database
|
||||
SPRING_DATASOURCE_URL: jdbc:mysql://mysql:3306/learning_progress_tracker?allowPublicKeyRetrieval=true&characterEncoding=utf-8&useSSL=false&serverTimezone=GMT%2B8
|
||||
@@ -0,0 +1,79 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lpt-ai
|
||||
namespace: lpt-dev
|
||||
labels:
|
||||
app: lpt-ai
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lpt-ai
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lpt-ai
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
containers:
|
||||
- name: lpt-ai
|
||||
image: 192.168.123.199:5000/lpt-ai:dev
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 5199
|
||||
env:
|
||||
- name: PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: PORT
|
||||
- name: LLM_API_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: LLM_API_URL
|
||||
- name: LLM_MODEL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: LLM_MODEL
|
||||
- name: LLM_TIMEOUT_MS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: LLM_TIMEOUT_MS
|
||||
- name: LLM_API_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: lpt-secrets
|
||||
key: llm-api-key
|
||||
resources:
|
||||
requests:
|
||||
cpu: 100m
|
||||
memory: 128Mi
|
||||
limits:
|
||||
cpu: 500m
|
||||
memory: 512Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 5199
|
||||
initialDelaySeconds: 10
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 5199
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
@@ -0,0 +1,73 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lpt-be
|
||||
namespace: lpt-dev
|
||||
labels:
|
||||
app: lpt-be
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lpt-be
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lpt-be
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
containers:
|
||||
- name: lpt-be
|
||||
image: 192.168.123.199:5000/lpt-be:dev
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 8888
|
||||
env:
|
||||
- name: SPRING_PROFILES_ACTIVE
|
||||
value: dev
|
||||
- name: SPRING_DATASOURCE_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: SPRING_DATASOURCE_URL
|
||||
- name: SPRING_DATASOURCE_USERNAME
|
||||
value: root
|
||||
- name: SPRING_DATASOURCE_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: lpt-secrets
|
||||
key: mysql-root-password
|
||||
- name: LPT_AI-SERVICE_URL
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: lpt-config
|
||||
key: LPT_AI-SERVICE_URL
|
||||
resources:
|
||||
requests:
|
||||
cpu: 250m
|
||||
memory: 512Mi
|
||||
limits:
|
||||
cpu: "1"
|
||||
memory: 1Gi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: 8888
|
||||
initialDelaySeconds: 60
|
||||
periodSeconds: 30
|
||||
timeoutSeconds: 10
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /actuator/health
|
||||
port: 8888
|
||||
initialDelaySeconds: 30
|
||||
periodSeconds: 10
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 3
|
||||
@@ -0,0 +1,53 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: lpt-fe
|
||||
namespace: lpt-dev
|
||||
labels:
|
||||
app: lpt-fe
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
app: lpt-fe
|
||||
strategy:
|
||||
type: RollingUpdate
|
||||
rollingUpdate:
|
||||
maxSurge: 25%
|
||||
maxUnavailable: 25%
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: lpt-fe
|
||||
spec:
|
||||
imagePullSecrets:
|
||||
- name: regcred
|
||||
containers:
|
||||
- name: lpt-fe
|
||||
image: 192.168.123.199:5000/lpt-fe:dev
|
||||
imagePullPolicy: IfNotPresent
|
||||
ports:
|
||||
- containerPort: 80
|
||||
resources:
|
||||
requests:
|
||||
cpu: 50m
|
||||
memory: 64Mi
|
||||
limits:
|
||||
cpu: 200m
|
||||
memory: 128Mi
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 15
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
port: 80
|
||||
initialDelaySeconds: 3
|
||||
periodSeconds: 5
|
||||
timeoutSeconds: 3
|
||||
failureThreshold: 3
|
||||
@@ -0,0 +1,20 @@
|
||||
# LPT Application Secrets — TEMPLATE
|
||||
# DO NOT commit real secrets to git!
|
||||
#
|
||||
# Create in the cluster:
|
||||
# kubectl create secret generic lpt-secrets \
|
||||
# --from-literal=llm-api-key=<YOUR_LLM_API_KEY> \
|
||||
# --from-literal=mysql-root-password=<YOUR_MYSQL_ROOT_PASSWORD> \
|
||||
# --namespace=lpt-dev
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: lpt-secrets
|
||||
namespace: lpt-dev
|
||||
type: Opaque
|
||||
data: {}
|
||||
# Use stringData when applying:
|
||||
# stringData:
|
||||
# llm-api-key: "sk-xxxxxxxxxxxxxxxx"
|
||||
# mysql-root-password: "your-mysql-password"
|
||||
@@ -0,0 +1,18 @@
|
||||
# Docker Registry Secret — TEMPLATE
|
||||
# DO NOT commit real credentials!
|
||||
#
|
||||
# Managed by Gitea Actions workflow or created manually:
|
||||
# kubectl create secret docker-registry regcred \
|
||||
# --docker-server=192.168.123.199:5000 \
|
||||
# --docker-username=admin \
|
||||
# --docker-password=<REGISTRY_PASSWORD> \
|
||||
# --namespace=lpt-dev
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: regcred
|
||||
namespace: lpt-dev
|
||||
type: kubernetes.io/dockerconfigjson
|
||||
data:
|
||||
.dockerconfigjson: ""
|
||||
@@ -0,0 +1,15 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: lpt-ai
|
||||
namespace: lpt-dev
|
||||
labels:
|
||||
app: lpt-ai
|
||||
spec:
|
||||
type: ClusterIP
|
||||
selector:
|
||||
app: lpt-ai
|
||||
ports:
|
||||
- port: 5199
|
||||
targetPort: 5199
|
||||
protocol: TCP
|
||||
Reference in New Issue
Block a user