From 2537fc5f761153a75925bc3cf842d977caab4f78 Mon Sep 17 00:00:00 2001 From: Davanum Srinivas Date: Thu, 18 Apr 2019 17:22:45 -0400 Subject: [PATCH] remove unused code Change-Id: If821920ec8872e326b7d85437ad8d2620807799d Kubernetes-commit: 7b8c9acc09d51a8f6018eafc49490102ae7cb0c4 --- scale/client.go | 4 ---- tools/cache/reflector.go | 6 ------ tools/cache/reflector_metrics.go | 17 ----------------- tools/clientcmd/client_config.go | 10 ---------- util/certificate/certificate_store.go | 7 ------- 5 files changed, 44 deletions(-) diff --git a/scale/client.go b/scale/client.go index ddf0d4ac..00e59752 100644 --- a/scale/client.go +++ b/scale/client.go @@ -30,10 +30,6 @@ import ( var scaleConverter = NewScaleConverter() var codecs = serializer.NewCodecFactory(scaleConverter.Scheme()) -// restInterfaceProvider turns a restclient.Config into a restclient.Interface. -// It's overridable for the purposes of testing. -type restInterfaceProvider func(*restclient.Config) (restclient.Interface, error) - // scaleClient is an implementation of ScalesGetter // which makes use of a RESTMapper and a generic REST // client to support an discoverable resource. diff --git a/tools/cache/reflector.go b/tools/cache/reflector.go index 4b5daeed..72a69ea6 100644 --- a/tools/cache/reflector.go +++ b/tools/cache/reflector.go @@ -25,7 +25,6 @@ import ( "net" "net/url" "reflect" - "strings" "sync" "syscall" "time" @@ -113,11 +112,6 @@ func NewNamedReflector(name string, lw ListerWatcher, expectedType interface{}, return r } -func makeValidPrometheusMetricLabel(in string) string { - // this isn't perfect, but it removes our common characters - return strings.NewReplacer("/", "_", ".", "_", "-", "_", ":", "_").Replace(in) -} - // internalPackages are packages that ignored when creating a default reflector name. These packages are in the common // call chains to NewReflector, so they'd be low entropy names for reflectors var internalPackages = []string{"client-go/tools/cache/"} diff --git a/tools/cache/reflector_metrics.go b/tools/cache/reflector_metrics.go index 0945e5c3..dd849c8f 100644 --- a/tools/cache/reflector_metrics.go +++ b/tools/cache/reflector_metrics.go @@ -94,23 +94,6 @@ var metricsFactory = struct { metricsProvider: noopMetricsProvider{}, } -func newReflectorMetrics(name string) *reflectorMetrics { - var ret *reflectorMetrics - if len(name) == 0 { - return ret - } - return &reflectorMetrics{ - numberOfLists: metricsFactory.metricsProvider.NewListsMetric(name), - listDuration: metricsFactory.metricsProvider.NewListDurationMetric(name), - numberOfItemsInList: metricsFactory.metricsProvider.NewItemsInListMetric(name), - numberOfWatches: metricsFactory.metricsProvider.NewWatchesMetric(name), - numberOfShortWatches: metricsFactory.metricsProvider.NewShortWatchesMetric(name), - watchDuration: metricsFactory.metricsProvider.NewWatchDurationMetric(name), - numberOfItemsInWatch: metricsFactory.metricsProvider.NewItemsInWatchMetric(name), - lastResourceVersion: metricsFactory.metricsProvider.NewLastResourceVersionMetric(name), - } -} - // SetReflectorMetricsProvider sets the metrics provider func SetReflectorMetricsProvider(metricsProvider MetricsProvider) { metricsFactory.setProviders.Do(func() { diff --git a/tools/clientcmd/client_config.go b/tools/clientcmd/client_config.go index a7b8c1c6..878e0df7 100644 --- a/tools/clientcmd/client_config.go +++ b/tools/clientcmd/client_config.go @@ -296,16 +296,6 @@ func makeUserIdentificationConfig(info clientauth.Info) *restclient.Config { return config } -// makeUserIdentificationFieldsConfig returns a client.Config capable of being merged using mergo for only server identification information -func makeServerIdentificationConfig(info clientauth.Info) restclient.Config { - config := restclient.Config{} - config.CAFile = info.CAFile - if info.Insecure != nil { - config.Insecure = *info.Insecure - } - return config -} - func canIdentifyUser(config restclient.Config) bool { return len(config.Username) > 0 || (len(config.CertFile) > 0 || len(config.CertData) > 0) || diff --git a/util/certificate/certificate_store.go b/util/certificate/certificate_store.go index d2666615..9b008084 100644 --- a/util/certificate/certificate_store.go +++ b/util/certificate/certificate_store.go @@ -23,7 +23,6 @@ import ( "fmt" "os" "path/filepath" - "strings" "time" "k8s.io/klog" @@ -289,12 +288,6 @@ func (s *fileStore) filename(qualifier string) string { return s.pairNamePrefix + "-" + qualifier + pemExtension } -// withoutExt returns the given filename after removing the extension. The -// extension to remove will be the result of filepath.Ext(). -func withoutExt(filename string) string { - return strings.TrimSuffix(filename, filepath.Ext(filename)) -} - func loadX509KeyPair(certFile, keyFile string) (*tls.Certificate, error) { cert, err := tls.LoadX509KeyPair(certFile, keyFile) if err != nil {