Skip to content

Commit 6dcd871

Browse files
committed
Renamings
1 parent 2db6008 commit 6dcd871

File tree

3 files changed

+15
-16
lines changed

3 files changed

+15
-16
lines changed

cmd/autoscaler/app/autoscaler.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import (
2525
"time"
2626

2727
"github.com/v3io/scaler/pkg/autoscaler"
28-
"github.com/v3io/scaler/pkg/autoscaler/factory"
28+
"github.com/v3io/scaler/pkg/autoscaler/metricsclients"
2929
"github.com/v3io/scaler/pkg/common"
3030
"github.com/v3io/scaler/pkg/pluginloader"
3131
"github.com/v3io/scaler/pkg/scalertypes"
@@ -104,7 +104,7 @@ func createAutoScaler(restConfig *rest.Config,
104104
}
105105

106106
// create metrics client using factory
107-
metricsClient, err := factory.NewMetricsClient(rootLogger, restConfig, options)
107+
metricsClient, err := metricsclients.NewMetricsClient(rootLogger, restConfig, options)
108108
if err != nil {
109109
return nil, errors.Wrap(err, "Failed to create metrics client")
110110
}

pkg/autoscaler/metricsclients/custommetricswrapper.go renamed to pkg/autoscaler/metricsclients/custommetrics.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,42 +30,42 @@ import (
3030
"k8s.io/client-go/discovery/cached/memory"
3131
"k8s.io/client-go/rest"
3232
"k8s.io/client-go/restmapper"
33-
"k8s.io/metrics/pkg/client/custom_metrics"
33+
k8scustommetrics "k8s.io/metrics/pkg/client/custom_metrics"
3434
)
3535

36-
type CustomMetricsWrapper struct {
37-
custom_metrics.CustomMetricsClient
36+
type CustomMetricsClient struct {
37+
k8scustommetrics.CustomMetricsClient
3838
namespace string
3939
groupKind schema.GroupKind
4040
logger logger.Logger
4141
}
4242

4343
// NewCustomMetricsClientFromConfig creates a custom_metrics.CustomMetricsClient from rest.Config
44-
func NewCustomMetricsClientFromConfig(restConfig *rest.Config) (custom_metrics.CustomMetricsClient, error) {
44+
func NewCustomMetricsClientFromConfig(restConfig *rest.Config) (k8scustommetrics.CustomMetricsClient, error) {
4545
discoveryClient, err := discovery.NewDiscoveryClientForConfig(restConfig)
4646
if err != nil {
4747
return nil, errors.Wrap(err, "Failed to create discovery client")
4848
}
49-
availableAPIsGetter := custom_metrics.NewAvailableAPIsGetter(discoveryClient)
49+
availableAPIsGetter := k8scustommetrics.NewAvailableAPIsGetter(discoveryClient)
5050
restMapper := restmapper.NewDeferredDiscoveryRESTMapper(memory.NewMemCacheClient(discoveryClient))
51-
customMetricsClient := custom_metrics.NewForConfig(restConfig, restMapper, availableAPIsGetter)
51+
customMetricsClient := k8scustommetrics.NewForConfig(restConfig, restMapper, availableAPIsGetter)
5252
return customMetricsClient, nil
5353
}
5454

5555
func NewCustomMetricsWrapper(
5656
logger logger.Logger,
57-
customMetricsClient custom_metrics.CustomMetricsClient,
57+
customMetricsClient k8scustommetrics.CustomMetricsClient,
5858
namespace string,
59-
groupKind schema.GroupKind) *CustomMetricsWrapper {
60-
return &CustomMetricsWrapper{
59+
groupKind schema.GroupKind) *CustomMetricsClient {
60+
return &CustomMetricsClient{
6161
logger: logger,
6262
CustomMetricsClient: customMetricsClient,
6363
namespace: namespace,
6464
groupKind: groupKind,
6565
}
6666
}
6767

68-
func (cmw *CustomMetricsWrapper) GetResourceMetrics(metricNames []string) (map[string]map[string]int, error) {
68+
func (cmw *CustomMetricsClient) GetResourceMetrics(metricNames []string) (map[string]map[string]int, error) {
6969
resourcesMetricsMap := make(map[string]map[string]int)
7070
resourceLabels := labels.Everything()
7171
metricSelectorLabels := labels.Everything()
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,11 @@ under the Apache 2.0 license is conditioned upon your compliance with
1818
such restriction.
1919
*/
2020

21-
package factory
21+
package metricsclients
2222

2323
import (
2424
"fmt"
2525

26-
"github.com/v3io/scaler/pkg/autoscaler/metricsclients"
2726
"github.com/v3io/scaler/pkg/scalertypes"
2827

2928
"github.com/nuclio/errors"
@@ -34,11 +33,11 @@ import (
3433
func NewMetricsClient(logger logger.Logger, restConfig *rest.Config, autoScalerConf scalertypes.AutoScalerOptions) (scalertypes.MetricsClient, error) {
3534
switch autoScalerConf.MetricClientOptions.Kind {
3635
case scalertypes.KindCustomMetrics:
37-
customMetricsClient, err := metricsclients.NewCustomMetricsClientFromConfig(restConfig)
36+
customMetricsClient, err := NewCustomMetricsClientFromConfig(restConfig)
3837
if err != nil {
3938
return nil, errors.Wrap(err, "Failed to create custom metrics client")
4039
}
41-
return metricsclients.NewCustomMetricsWrapper(
40+
return NewCustomMetricsWrapper(
4241
logger.GetChild("customMetricsClient"),
4342
customMetricsClient,
4443
autoScalerConf.Namespace,

0 commit comments

Comments
 (0)