Skip to content

Commit b0e6011

Browse files
pavelriblevrado
authored andcommitted
Metrics group kind to be passed through cli (#24)
1 parent 3f97369 commit b0e6011

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

cmd/autoscaler/app/autoscaler.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ func Run(kubeconfigPath string,
2121
scaleWindow time.Duration,
2222
metricName string,
2323
scaleThreshold int64,
24-
metricsInterval time.Duration) error {
24+
metricsInterval time.Duration,
25+
metricsGroupKind string) error {
2526
autoScalerOptions := scaler_types.AutoScalerOptions{
2627
Namespace: namespace,
2728
ScaleInterval: scaleInterval,
@@ -34,6 +35,7 @@ func Run(kubeconfigPath string,
3435
Namespace: namespace,
3536
MetricName: metricName,
3637
MetricInterval: metricsInterval,
38+
GroupKind: metricsGroupKind,
3739
}
3840

3941
pluginLoader, err := pluginloader.New()

cmd/autoscaler/main.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func main() {
1717
scaleInterval := flag.Duration("scale-interval", time.Minute, "Interval to call check scale function")
1818
scaleWindow := flag.Duration("scale-window", time.Minute, "Time window after initial value to act upon")
1919
metricsInterval := flag.Duration("metrics-poll-interval", time.Minute, "Interval to poll custom metrics")
20+
metricsGroupKind := flag.String("metrics-group-kind", "", "Metrics resource kind")
2021
metricName := flag.String("metric-name", "", "Metric name from custom metrics")
2122
scaleThreshold := flag.Int64("scale-threshold", 0, "Maximum allowed value for metric to be considered below active")
2223
flag.Parse()
@@ -29,7 +30,8 @@ func main() {
2930
*scaleWindow,
3031
*metricName,
3132
*scaleThreshold,
32-
*metricsInterval); err != nil {
33+
*metricsInterval,
34+
*metricsGroupKind); err != nil {
3335
errors.PrintErrorStack(os.Stderr, err, 5)
3436

3537
os.Exit(1)

0 commit comments

Comments
 (0)