mirror of
https://github.com/informaticker/uek-109-LBb.git
synced 2024-11-22 01:31: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."
|
echo "you buffoon change your github username in the file."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
replace_placeholders() {
|
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-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
|
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/configmap.yaml
|
||||||
oc apply -f deployment/secrets.yaml
|
oc apply -f deployment/secrets.yaml
|
||||||
oc apply -f deployment/database.yaml
|
oc apply -f deployment/database.yaml
|
||||||
|
oc apply -f deployment/pvc.yaml
|
||||||
oc apply -f deployment/backend.yaml
|
oc apply -f deployment/backend.yaml
|
||||||
oc apply -f deployment/frontend.yaml
|
oc apply -f deployment/frontend.yaml
|
||||||
|
oc apply -f deployment/hpa.yaml
|
||||||
|
|
||||||
echo "Deployment completed successfully! ^w^"
|
echo "Deployment completed successfully! ^w^"
|
@ -35,6 +35,13 @@ spec:
|
|||||||
secretKeyRef:
|
secretKeyRef:
|
||||||
name: counter-database
|
name: counter-database
|
||||||
key: database-name
|
key: database-name
|
||||||
|
volumeMounts:
|
||||||
|
- name: postgresql-data
|
||||||
|
mountPath: /var/lib/pgsql/data
|
||||||
|
volumes:
|
||||||
|
- name: postgresql-data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: counter-database-pvc
|
||||||
|
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
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