Skip to content

Commit

Permalink
Metrics group kind to be passed through cli (#24)
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelrib authored and levrado committed Jan 30, 2019
1 parent 3f97369 commit b0e6011
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion cmd/autoscaler/app/autoscaler.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ func Run(kubeconfigPath string,
scaleWindow time.Duration,
metricName string,
scaleThreshold int64,
metricsInterval time.Duration) error {
metricsInterval time.Duration,
metricsGroupKind string) error {
autoScalerOptions := scaler_types.AutoScalerOptions{
Namespace: namespace,
ScaleInterval: scaleInterval,
Expand All @@ -34,6 +35,7 @@ func Run(kubeconfigPath string,
Namespace: namespace,
MetricName: metricName,
MetricInterval: metricsInterval,
GroupKind: metricsGroupKind,
}

pluginLoader, err := pluginloader.New()
Expand Down
4 changes: 3 additions & 1 deletion cmd/autoscaler/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ func main() {
scaleInterval := flag.Duration("scale-interval", time.Minute, "Interval to call check scale function")
scaleWindow := flag.Duration("scale-window", time.Minute, "Time window after initial value to act upon")
metricsInterval := flag.Duration("metrics-poll-interval", time.Minute, "Interval to poll custom metrics")
metricsGroupKind := flag.String("metrics-group-kind", "", "Metrics resource kind")
metricName := flag.String("metric-name", "", "Metric name from custom metrics")
scaleThreshold := flag.Int64("scale-threshold", 0, "Maximum allowed value for metric to be considered below active")
flag.Parse()
Expand All @@ -29,7 +30,8 @@ func main() {
*scaleWindow,
*metricName,
*scaleThreshold,
*metricsInterval); err != nil {
*metricsInterval,
*metricsGroupKind); err != nil {
errors.PrintErrorStack(os.Stderr, err, 5)

os.Exit(1)
Expand Down

0 comments on commit b0e6011

Please sign in to comment.