Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
192 changes: 192 additions & 0 deletions online-boutique/kustomize/autoscaling.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: frontend-scaler
spec:
scaleTargetRef:
name: frontend
kind: Deployment
minReplicaCount: 2
maxReplicaCount: 10
pollingInterval: 15
cooldownPeriod: 300
triggers:
- type: prometheus
metadata:
serverAddress: http://kube-prometheus-stack-prometheus.k8saas-system.svc.cluster.local.:9090
metricName: nginx_ingress_requests
threshold: '30'
query: |
sum(rate(nginx_ingress_controller_requests{namespace="online-boutique",service="frontend",status!~"[4-5].*"}[2m]))
activationThreshold: '5'
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: cartservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: cartservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: checkoutservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: checkoutservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: productcatalogservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: productcatalogservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: recommendationservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: recommendationservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: paymentservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: paymentservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 70
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: shippingservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: shippingservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: currencyservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: currencyservice
minReplicas: 1
maxReplicas: 6
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: emailservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: emailservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
---
apiVersion: autoscaling/v2
kind: HorizontalPodAutoscaler
metadata:
name: adservice
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: adservice
minReplicas: 1
maxReplicas: 4
metrics:
- type: Resource
resource:
name: cpu
target:
type: Utilization
averageUtilization: 75
2 changes: 1 addition & 1 deletion online-boutique/kustomize/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ resources:
- dashboard.yaml
- slo.yaml
- velero-backup.yaml
- autoscaling.yaml
components:
- https://github.com/GoogleCloudPlatform/microservices-demo//kustomize/components/network-policies?timeout=90s&ref=6af73dcf7fe1ca653d95ae7a29e12faf8cf02964
- https://github.com/GoogleCloudPlatform/microservices-demo//kustomize/components/non-public-frontend?timeout=90s&ref=6af73dcf7fe1ca653d95ae7a29e12faf8cf02964
Expand All @@ -19,4 +20,3 @@ patches:
- path: patch-enable-tracing.yaml
- path: patch-frontend-admin-panel.yaml
- path: patch-loadgenerator-config.yaml
- path: patch-currency-service-limits.yaml
12 changes: 0 additions & 12 deletions online-boutique/kustomize/patch-currency-service-limits.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion online-boutique/kustomize/patch-loadgenerator-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ spec:
- name: FRONTEND_PROTO
value: https
- name: USERS
value: "240"
value: "600"