@@ -18,7 +18,7 @@ under the Apache 2.0 license is conditioned upon your compliance with
1818such restriction.
1919*/
2020
21- package metricsclients
21+ package metricsclient
2222
2323import (
2424 "github.com/nuclio/errors"
@@ -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
55- func NewCustomMetricsWrapper (
55+ func NewCustomMetricsClient (
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 ()
0 commit comments