Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

支持external指标 #46

Merged
merged 1 commit into from
Nov 21, 2024
Merged
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
8 changes: 4 additions & 4 deletions pkg/controller/controller_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,8 @@ func parseMetricSpecForPrometheus(target string, metricType string, metricValue
}

metricSpec := autoscalingv2.MetricSpec{
Type: autoscalingv2.PodsMetricSourceType,
Pods: &autoscalingv2.PodsMetricSource{
Type: autoscalingv2.ExternalMetricSourceType,
External: &autoscalingv2.ExternalMetricSource{
Metric: autoscalingv2.MetricIdentifier{
Name: name,
},
Expand All @@ -271,9 +271,9 @@ func parseMetricSpecForPrometheus(target string, metricType string, metricValue

switch target {
case targetAverageUtilization:
metricSpec.Pods.Target.Type = autoscalingv2.UtilizationMetricType
metricSpec.External.Target.Type = autoscalingv2.UtilizationMetricType
case targetAverageValue:
metricSpec.Pods.Target.Type = autoscalingv2.AverageValueMetricType
metricSpec.External.Target.Type = autoscalingv2.AverageValueMetricType
}

return metricSpec, nil
Expand Down
2 changes: 1 addition & 1 deletion pkg/controller/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
memoryAverageUtilization = "memory." + PixiuRootPrefix + PixiuSeparator + targetAverageUtilization
prometheusAverageUtilization = "prometheus." + PixiuRootPrefix + PixiuSeparator + targetAverageUtilization

// 指标来着 prometheus 时,需要指定指标名称
// 指标来自 prometheus 时,需要指定指标名称
prometheusCustomMetric = PixiuRootPrefix + PixiuSeparator + "targetCustomMetric"

// CPU, in cores. (500m = .5 cores)
Expand Down
Loading