Skip to content

Commit

Permalink
Make ClientCache public
Browse files Browse the repository at this point in the history
  • Loading branch information
uluyol-goog committed Aug 11, 2015
1 parent a53a3b7 commit 01807c1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions pkg/kubectl/cmd/util/clientcache.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ import (
"k8s.io/kubernetes/pkg/client/clientcmd"
)

func NewClientCache(loader clientcmd.ClientConfig) *clientCache {
return &clientCache{
func NewClientCache(loader clientcmd.ClientConfig) *ClientCache {
return &ClientCache{
clients: make(map[string]*client.Client),
configs: make(map[string]*client.Config),
loader: loader,
}
}

// clientCache caches previously loaded clients for reuse, and ensures MatchServerVersion
// ClientCache caches previously loaded clients for reuse, and ensures MatchServerVersion
// is invoked only once
type clientCache struct {
type ClientCache struct {
loader clientcmd.ClientConfig
clients map[string]*client.Client
configs map[string]*client.Config
Expand All @@ -42,7 +42,7 @@ type clientCache struct {
}

// ClientConfigForVersion returns the correct config for a server
func (c *clientCache) ClientConfigForVersion(version string) (*client.Config, error) {
func (c *ClientCache) ClientConfigForVersion(version string) (*client.Config, error) {
if c.defaultConfig == nil {
config, err := c.loader.ClientConfig()
if err != nil {
Expand Down Expand Up @@ -73,7 +73,7 @@ func (c *clientCache) ClientConfigForVersion(version string) (*client.Config, er

// ClientForVersion initializes or reuses a client for the specified version, or returns an
// error if that is not possible
func (c *clientCache) ClientForVersion(version string) (*client.Client, error) {
func (c *ClientCache) ClientForVersion(version string) (*client.Client, error) {
if client, ok := c.clients[version]; ok {
return client, nil
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/kubectl/cmd/util/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const (
// TODO: pass the various interfaces on the factory directly into the command constructors (so the
// commands are decoupled from the factory).
type Factory struct {
clients *clientCache
clients *ClientCache
flags *pflag.FlagSet
generators map[string]kubectl.Generator

Expand Down

0 comments on commit 01807c1

Please sign in to comment.