Skip to content

Commit

Permalink
feat: keda prometheus autoscaler
Browse files Browse the repository at this point in the history
  • Loading branch information
crgisch committed Apr 9, 2024
1 parent fe8da98 commit 22a1e08
Show file tree
Hide file tree
Showing 8 changed files with 171 additions and 13 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ Class | Method | HTTP request | Description
- [AppVolumeBinds](docs/AppVolumeBinds.md)
- [AssignGroupArgs](docs/AssignGroupArgs.md)
- [AssignTokenArgs](docs/AssignTokenArgs.md)
- [AutoScalePrometheus](docs/AutoScalePrometheus.md)
- [AutoScaleSchedule](docs/AutoScaleSchedule.md)
- [AutoScaleSpec](docs/AutoScaleSpec.md)
- [CertificateSetData](docs/CertificateSetData.md)
Expand Down
134 changes: 127 additions & 7 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5910,29 +5910,55 @@ components:
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
- process: process
averageCPU: averageCPU
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
tags:
- tags
- tags
Expand Down Expand Up @@ -6107,9 +6133,12 @@ components:
example:
minReplicas: 7
timezone: timezone
name: name
start: start
end: end
properties:
name:
type: string
minReplicas:
type: integer
start:
Expand Down Expand Up @@ -7059,15 +7088,28 @@ components:
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
properties:
process:
type: string
Expand All @@ -7081,6 +7123,10 @@ components:
items:
$ref: '#/components/schemas/AutoScaleSchedule'
type: array
prometheus:
items:
$ref: '#/components/schemas/AutoScalePrometheus'
type: array
version:
type: integer
type: object
Expand Down Expand Up @@ -8464,29 +8510,55 @@ components:
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
- process: process
averageCPU: averageCPU
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
tags:
- tags
- tags
Expand Down Expand Up @@ -8681,29 +8753,55 @@ components:
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
- process: process
averageCPU: averageCPU
schedules:
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
- minReplicas: 7
timezone: timezone
name: name
start: start
end: end
maxUnits: 2
minUnits: 5
version: 9
prometheus:
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
- prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
version: 2
tags:
- tags
- tags
Expand Down Expand Up @@ -9107,6 +9205,28 @@ components:
private:
type: boolean
type: object
AutoScalePrometheus:
description: Auto Scale prometheus struct
example:
prometheusAddress: prometheusAddress
query: query
name: name
threshold: 9.301444243932575517419536481611430644989013671875
activationThreshold: 3.61607674925191080461672754609026014804840087890625
properties:
name:
type: string
query:
type: string
threshold:
type: number
x-go-custom-type: float64
activationThreshold:
type: number
x-go-custom-type: float64
prometheusAddress:
type: string
type: object
ServiceInstanceInfo:
example:
teams:
Expand Down
14 changes: 14 additions & 0 deletions docs/AutoScalePrometheus.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# AutoScalePrometheus

## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**Query** | **string** | | [optional]
**Threshold** | **float32** | | [optional]
**ActivationThreshold** | **float32** | | [optional]
**PrometheusAddress** | **string** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)


1 change: 1 addition & 0 deletions docs/AutoScaleSchedule.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Name** | **string** | | [optional]
**MinReplicas** | **int32** | | [optional]
**Start** | **string** | | [optional]
**End** | **string** | | [optional]
Expand Down
1 change: 1 addition & 0 deletions docs/AutoScaleSpec.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Name | Type | Description | Notes
**MaxUnits** | **int32** | | [optional]
**AverageCPU** | **string** | | [optional]
**Schedules** | [**[]AutoScaleSchedule**](AutoScaleSchedule.md) | | [optional]
**Prometheus** | [**[]AutoScalePrometheus**](AutoScalePrometheus.md) | | [optional]
**Version** | **int32** | | [optional]

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down
19 changes: 19 additions & 0 deletions pkg/tsuru/model_auto_scale_prometheus.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Tsuru
*
* Open source, extensible and Docker-based Platform as a Service (PaaS)
*
* API version: 1.20
* Generated by: OpenAPI Generator (https://openapi-generator.tech)
*/

package tsuru

// Auto Scale prometheus struct
type AutoScalePrometheus struct {
Name string `json:"name,omitempty"`
Query string `json:"query,omitempty"`
Threshold float64 `json:"threshold,omitempty"`
ActivationThreshold float64 `json:"activationThreshold,omitempty"`
PrometheusAddress string `json:"prometheusAddress,omitempty"`
}
1 change: 1 addition & 0 deletions pkg/tsuru/model_auto_scale_schedule.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ package tsuru

// Auto Scale schedules struct
type AutoScaleSchedule struct {
Name string `json:"name,omitempty"`
MinReplicas int32 `json:"minReplicas,omitempty"`
Start string `json:"start,omitempty"`
End string `json:"end,omitempty"`
Expand Down
13 changes: 7 additions & 6 deletions pkg/tsuru/model_auto_scale_spec.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ package tsuru

// Units Auto Scale spec
type AutoScaleSpec struct {
Process string `json:"process,omitempty"`
MinUnits int32 `json:"minUnits,omitempty"`
MaxUnits int32 `json:"maxUnits,omitempty"`
AverageCPU string `json:"averageCPU,omitempty"`
Schedules []AutoScaleSchedule `json:"schedules,omitempty"`
Version int32 `json:"version,omitempty"`
Process string `json:"process,omitempty"`
MinUnits int32 `json:"minUnits,omitempty"`
MaxUnits int32 `json:"maxUnits,omitempty"`
AverageCPU string `json:"averageCPU,omitempty"`
Schedules []AutoScaleSchedule `json:"schedules,omitempty"`
Prometheus []AutoScalePrometheus `json:"prometheus,omitempty"`
Version int32 `json:"version,omitempty"`
}

0 comments on commit 22a1e08

Please sign in to comment.