mirror of
https://github.com/informaticker/uek-109-LBb.git
synced 2024-11-21 17:21:58 +01:00
Add Autoscalers and PVC for DB
This commit is contained in:
parent
db97a4715f
commit
fdf9ff9198
@ -5,7 +5,6 @@ if [ "$GITHUB_USERNAME" == "your_github_username" ]; then
|
||||
echo "you buffoon change your github username in the file."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
replace_placeholders() {
|
||||
sed -i "s|ghcr.io/informaticker/zli-counter-frontend:v1|ghcr.io/${GITHUB_USERNAME}/zli-counter-frontend:${VERSION}|g" deployment/frontend.yaml
|
||||
sed -i "s|ghcr.io/informaticker/zli-counter-backend:v1|ghcr.io/${GITHUB_USERNAME}/zli-counter-backend:${VERSION}|g" deployment/backend.yaml
|
||||
@ -18,7 +17,9 @@ replace_placeholders
|
||||
oc apply -f deployment/configmap.yaml
|
||||
oc apply -f deployment/secrets.yaml
|
||||
oc apply -f deployment/database.yaml
|
||||
oc apply -f deployment/pvc.yaml
|
||||
oc apply -f deployment/backend.yaml
|
||||
oc apply -f deployment/frontend.yaml
|
||||
oc apply -f deployment/hpa.yaml
|
||||
|
||||
echo "Deployment completed successfully! ^w^"
|
@ -35,6 +35,13 @@ spec:
|
||||
secretKeyRef:
|
||||
name: counter-database
|
||||
key: database-name
|
||||
volumeMounts:
|
||||
- name: postgresql-data
|
||||
mountPath: /var/lib/pgsql/data
|
||||
volumes:
|
||||
- name: postgresql-data
|
||||
persistentVolumeClaim:
|
||||
claimName: counter-database-pvc
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
@ -47,4 +54,4 @@ spec:
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 5432
|
||||
targetPort: 5432
|
||||
targetPort: 5432
|
39
deployment/hpa.yaml
Normal file
39
deployment/hpa.yaml
Normal file
@ -0,0 +1,39 @@
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: counter-backend
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: counter-backend
|
||||
minReplicas: 2
|
||||
maxReplicas: 8
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 50
|
||||
|
||||
---
|
||||
apiVersion: autoscaling/v2
|
||||
kind: HorizontalPodAutoscaler
|
||||
metadata:
|
||||
name: counter-frontend
|
||||
spec:
|
||||
scaleTargetRef:
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
name: counter-frontend
|
||||
minReplicas: 2
|
||||
maxReplicas: 12
|
||||
metrics:
|
||||
- type: Resource
|
||||
resource:
|
||||
name: cpu
|
||||
target:
|
||||
type: Utilization
|
||||
averageUtilization: 50
|
11
deployment/pvc.yaml
Normal file
11
deployment/pvc.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: PersistentVolumeClaim
|
||||
metadata:
|
||||
name: counter-database-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 1Gi
|
Loading…
Reference in New Issue
Block a user