-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support autoscaling on broker and bookie (#1183)
* feat: add autoscaling on chart Signed-off-by: ericsyh <[email protected]> * apply autoscaling on sn-platform Signed-off-by: ericsyh <[email protected]> * add autoscaling examples Signed-off-by: ericsyh <[email protected]> * fix name Signed-off-by: ericsyh <[email protected]> --------- Signed-off-by: ericsyh <[email protected]>
- Loading branch information
Showing
9 changed files
with
241 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
broker: | ||
autoScaling: | ||
enabled: true | ||
minReplicas: 1 | ||
maxReplicas: 4 | ||
# Deploy the https://prometheus.io/ and https://github.com/kubernetes-sigs/prometheus-adapter to support custom metrics. | ||
# Refer the prometheus.-adapter.yaml how to setup the custom metrics. | ||
metrics: | ||
- pods: | ||
metric: | ||
name: cpu_usage | ||
target: | ||
averageValue: "75" | ||
type: AverageValue | ||
type: Pods | ||
- pods: | ||
metric: | ||
name: network_in_rate_kb | ||
target: | ||
averageValue: "204800" | ||
type: AverageValue | ||
type: Pods | ||
- pods: | ||
metric: | ||
name: network_out_rate_kb | ||
target: | ||
averageValue: "204800" | ||
type: AverageValue | ||
type: Pods | ||
|
||
bookkeeper: | ||
autoScaling: | ||
enabled: true | ||
minReplicas: 1 | ||
maxReplicas: 4 | ||
# Deploy the https://prometheus.io/ and https://github.com/kubernetes-sigs/prometheus-adapter to support custom metrics. | ||
# Refer the prometheus.-adapter.yaml how to setup the custom metrics. | ||
metrics: | ||
- pods: | ||
metric: | ||
name: cpu_usage | ||
target: | ||
averageValue: "75" | ||
type: AverageValue | ||
type: Pods | ||
- pods: | ||
metric: | ||
name: network_in_rate_kb | ||
target: | ||
averageValue: "204800" | ||
type: AverageValue | ||
type: Pods | ||
- pods: | ||
metric: | ||
name: network_out_rate_kb | ||
target: | ||
averageValue: "204800" | ||
type: AverageValue | ||
type: Pods |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
broker: | ||
autoScaling: | ||
enabled: true | ||
minReplicas: 1 | ||
maxReplicas: 4 | ||
# Deploy the https://github.com/kubernetes-sigs/metrics-server to support resource metrics. | ||
# Metrics server supports the cpu and memory PodMetrics. | ||
metrics: | ||
type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: 70 | ||
|
||
bookkeeper: | ||
autoScaling: | ||
enabled: true | ||
minReplicas: 1 | ||
maxReplicas: 4 | ||
# Deploy the https://github.com/kubernetes-sigs/metrics-server to support resource metrics. | ||
# Metrics server supports the cpu and memory PodMetrics. | ||
metrics: | ||
type: Resource | ||
resource: | ||
name: cpu | ||
target: | ||
type: Utilization | ||
averageUtilization: 70 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
prometheus: | ||
url: http://prometheus-server.monitor.svc | ||
port: 80 | ||
listenPort: 8443 | ||
rules: | ||
default: false | ||
custom: | ||
- seriesQuery: '{namespace!="",__name__!~"^container_.*"}' | ||
resources: | ||
template: "<<.Resource>>" | ||
name: | ||
matches: "^(.*)_total" | ||
as: "" | ||
metricsQuery: | | ||
sum by (<<.GroupBy>>) ( | ||
irate ( | ||
<<.Series>>{<<.LabelMatchers>>}[1m] | ||
) | ||
) | ||
- seriesQuery: 'container_cpu_usage_seconds_total{namespace!~"(sn-system|kube-system|olm|cert-manager)"}' | ||
seriesFilters: [] | ||
resources: | ||
overrides: | ||
pod: | ||
resource: pod | ||
namespace: | ||
resource: namespace | ||
name: | ||
matches: "container_cpu_usage_seconds_total" | ||
as: "cpu_usage" | ||
metricsQuery: sum(rate(container_cpu_usage_seconds_total{<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>) / (sum(container_spec_cpu_shares{<<.LabelMatchers>>}/1000) by (<<.GroupBy>>)) * 100 | ||
- seriesQuery: 'container_network_receive_bytes_total{namespace!~"(sn-system|kube-system|olm|cert-manager)"}' | ||
seriesFilters: [] | ||
resources: | ||
overrides: | ||
pod: | ||
resource: pod | ||
namespace: | ||
resource: namespace | ||
name: | ||
matches: "container_network_receive_bytes_total" | ||
as: "network_in_rate_kb" | ||
metricsQuery: rate(container_network_receive_bytes_total{<<.LabelMatchers>>}[5m]) / 1024 | ||
- seriesQuery: 'container_network_transmit_bytes_total{namespace!~"(sn-system|kube-system|olm|cert-manager)"}' | ||
seriesFilters: [] | ||
resources: | ||
overrides: | ||
pod: | ||
resource: pod | ||
namespace: | ||
resource: namespace | ||
name: | ||
matches: "container_network_transmit_bytes_total" | ||
as: "network_out_rate_kb" | ||
metricsQuery: rate(container_network_transmit_bytes_total{<<.LabelMatchers>>}[5m]) / 1024 | ||
- seriesQuery: 'container_fs_reads_bytes_total{namespace!~"(sn-system|kube-system|olm|cert-manager)"}' | ||
seriesFilters: [] | ||
resources: | ||
overrides: | ||
pod: | ||
resource: pod | ||
namespace: | ||
resource: namespace | ||
name: | ||
matches: "container_fs_reads_bytes_total" | ||
as: "disk_read_rate_kb" | ||
metricsQuery: sum(rate(container_fs_reads_bytes_total{<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>) / 1024 | ||
- seriesQuery: 'container_fs_writes_bytes_total{namespace!~"(sn-system|kube-system|olm|cert-manager)"}' | ||
seriesFilters: [] | ||
resources: | ||
overrides: | ||
pod: | ||
resource: pod | ||
namespace: | ||
resource: namespace | ||
name: | ||
matches: "container_fs_writes_bytes_total" | ||
as: "disk_write_rate_kb" | ||
metricsQuery: sum(rate(container_fs_writes_bytes_total{<<.LabelMatchers>>}[5m])) by (<<.GroupBy>>) / 1024 |