179 lines
4.2 KiB
YAML
179 lines
4.2 KiB
YAML
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: todo-backend
|
|
namespace: todo-test
|
|
labels:
|
|
app: todo-backend
|
|
spec:
|
|
replicas: 2
|
|
selector:
|
|
matchLabels:
|
|
app: todo-backend
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: todo-backend
|
|
spec:
|
|
imagePullSecrets:
|
|
- name: todo-registry-secret
|
|
containers:
|
|
- name: todo-backend
|
|
image: ccr.ccs.tencentyun.com/violin/todo-backend:latest
|
|
imagePullPolicy: Always
|
|
ports:
|
|
- containerPort: 8080
|
|
env:
|
|
- name: SPRING_DATASOURCE_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_DATASOURCE_HOST
|
|
- name: SPRING_DATASOURCE_PORT
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_DATASOURCE_PORT
|
|
- name: SPRING_DATASOURCE_DB
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_DATASOURCE_DB
|
|
- name: SPRING_DATASOURCE_USERNAME
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_DATASOURCE_USERNAME
|
|
- name: SPRING_DATASOURCE_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: todo-db-secret
|
|
key: DATABASE_PASSWORD
|
|
- name: SPRING_REDIS_HOST
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_REDIS_HOST
|
|
- name: SPRING_REDIS_PORT
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_REDIS_PORT
|
|
- name: SPRING_REDIS_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: todo-db-secret
|
|
key: REDIS_PASSWORD
|
|
resources:
|
|
requests:
|
|
memory: "512Mi"
|
|
cpu: "250m"
|
|
limits:
|
|
memory: "1Gi"
|
|
cpu: "500m"
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /actuator/health
|
|
port: 8080
|
|
initialDelaySeconds: 60
|
|
periodSeconds: 10
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /actuator/health
|
|
port: 8080
|
|
initialDelaySeconds: 30
|
|
periodSeconds: 5
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: todo-postgres
|
|
namespace: todo-test
|
|
labels:
|
|
app: todo-postgres
|
|
spec:
|
|
serviceName: todo-postgres
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: todo-postgres
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: todo-postgres
|
|
spec:
|
|
containers:
|
|
- name: postgres
|
|
image: postgres:15-alpine
|
|
ports:
|
|
- containerPort: 5432
|
|
env:
|
|
- name: POSTGRES_DB
|
|
value: building_materials
|
|
- name: POSTGRES_USER
|
|
valueFrom:
|
|
configMapKeyRef:
|
|
name: todo-config
|
|
key: SPRING_DATASOURCE_USERNAME
|
|
- name: POSTGRES_PASSWORD
|
|
valueFrom:
|
|
secretKeyRef:
|
|
name: todo-db-secret
|
|
key: DATABASE_PASSWORD
|
|
volumeMounts:
|
|
- name: postgres-data
|
|
mountPath: /var/lib/postgresql/data
|
|
- name: init-sql
|
|
mountPath: /docker-entrypoint-initdb.d
|
|
resources:
|
|
requests:
|
|
memory: "256Mi"
|
|
cpu: "100m"
|
|
limits:
|
|
memory: "512Mi"
|
|
cpu: "500m"
|
|
volumes:
|
|
- name: postgres-data
|
|
emptyDir: {}
|
|
- name: init-sql
|
|
configMap:
|
|
name: todo-init-sql
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: StatefulSet
|
|
metadata:
|
|
name: todo-redis
|
|
namespace: todo-test
|
|
labels:
|
|
app: todo-redis
|
|
spec:
|
|
serviceName: todo-redis
|
|
replicas: 1
|
|
selector:
|
|
matchLabels:
|
|
app: todo-redis
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app: todo-redis
|
|
spec:
|
|
containers:
|
|
- name: redis
|
|
image: redis:7-alpine
|
|
ports:
|
|
- containerPort: 6379
|
|
command: ["redis-server"]
|
|
resources:
|
|
requests:
|
|
memory: "128Mi"
|
|
cpu: "50m"
|
|
limits:
|
|
memory: "256Mi"
|
|
cpu: "200m"
|
|
volumeMounts:
|
|
- name: redis-data
|
|
mountPath: /data
|
|
volumes:
|
|
- name: redis-data
|
|
emptyDir: {}
|