Skip to content

Commit

Permalink
add Keda examole
Browse files Browse the repository at this point in the history
  • Loading branch information
eumel8 committed Nov 30, 2023
1 parent cfccf3f commit 41a5eee
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
6 changes: 6 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,9 @@ Patch deployment and adjust cpu resources based on eco power generation
see [./hpa/](hpa)

Patch hpa and adjust replicas based on eco power generation

## Keda Prometheus

see [./keda-prometheus/](keda-prometheus)

Use ScaledObject from [https://keda.io](Keda) to fetch Prometheus metrics of carbon emission and act on workload deployment
34 changes: 34 additions & 0 deletions examples/keda-prometheus/prometheus-scale.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
apiVersion: keda.sh/v1alpha1
kind: ScaledObject
metadata:
name: carbon-keda-scaledobject
spec:
scaleTargetRef:
apiVersion: apps/v1
kind: Deployment
name: demoapp
pollingInterval: 10 # Optional. Default: 30 seconds
cooldownPeriod: 300 # Optional. Default: 300 seconds
minReplicaCount: 1 # Optional. Default: 0
maxReplicaCount: 4 # Optional. Default: 100
fallback: # Optional. Section to specify fallback options
failureThreshold: 3 # Mandatory if fallback section is included
replicas: 1
advanced: # Optional. Section to specify advanced options
horizontalPodAutoscalerConfig: # Optional. Section to specify HPA related options
behavior: # Optional. Use to modify HPA's scaling behavior
scaleDown:
stabilizationWindowSeconds: 150
policies:
- type: Percent
value: 100
periodSeconds: 15
triggers:
- type: prometheus
metadata:
serverAddress: http://carbon-prometheus-server.carbon
metricName: entsoe_generation_eco
query: entsoe_generation_eco{job="entsoe-carbon-footprint"}*100
threshold: '65'


0 comments on commit 41a5eee

Please sign in to comment.