Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
01807c1f
Commit
01807c1f
authored
Aug 10, 2015
by
Muhammed Uluyol
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make ClientCache public
parent
a53a3b7e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
7 deletions
+7
-7
clientcache.go
pkg/kubectl/cmd/util/clientcache.go
+6
-6
factory.go
pkg/kubectl/cmd/util/factory.go
+1
-1
No files found.
pkg/kubectl/cmd/util/clientcache.go
View file @
01807c1f
...
@@ -22,17 +22,17 @@ import (
...
@@ -22,17 +22,17 @@ import (
"k8s.io/kubernetes/pkg/client/clientcmd"
"k8s.io/kubernetes/pkg/client/clientcmd"
)
)
func
NewClientCache
(
loader
clientcmd
.
ClientConfig
)
*
c
lientCache
{
func
NewClientCache
(
loader
clientcmd
.
ClientConfig
)
*
C
lientCache
{
return
&
c
lientCache
{
return
&
C
lientCache
{
clients
:
make
(
map
[
string
]
*
client
.
Client
),
clients
:
make
(
map
[
string
]
*
client
.
Client
),
configs
:
make
(
map
[
string
]
*
client
.
Config
),
configs
:
make
(
map
[
string
]
*
client
.
Config
),
loader
:
loader
,
loader
:
loader
,
}
}
}
}
//
c
lientCache caches previously loaded clients for reuse, and ensures MatchServerVersion
//
C
lientCache caches previously loaded clients for reuse, and ensures MatchServerVersion
// is invoked only once
// is invoked only once
type
c
lientCache
struct
{
type
C
lientCache
struct
{
loader
clientcmd
.
ClientConfig
loader
clientcmd
.
ClientConfig
clients
map
[
string
]
*
client
.
Client
clients
map
[
string
]
*
client
.
Client
configs
map
[
string
]
*
client
.
Config
configs
map
[
string
]
*
client
.
Config
...
@@ -42,7 +42,7 @@ type clientCache struct {
...
@@ -42,7 +42,7 @@ type clientCache struct {
}
}
// ClientConfigForVersion returns the correct config for a server
// ClientConfigForVersion returns the correct config for a server
func
(
c
*
c
lientCache
)
ClientConfigForVersion
(
version
string
)
(
*
client
.
Config
,
error
)
{
func
(
c
*
C
lientCache
)
ClientConfigForVersion
(
version
string
)
(
*
client
.
Config
,
error
)
{
if
c
.
defaultConfig
==
nil
{
if
c
.
defaultConfig
==
nil
{
config
,
err
:=
c
.
loader
.
ClientConfig
()
config
,
err
:=
c
.
loader
.
ClientConfig
()
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -73,7 +73,7 @@ func (c *clientCache) ClientConfigForVersion(version string) (*client.Config, er
...
@@ -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
// ClientForVersion initializes or reuses a client for the specified version, or returns an
// error if that is not possible
// error if that is not possible
func
(
c
*
c
lientCache
)
ClientForVersion
(
version
string
)
(
*
client
.
Client
,
error
)
{
func
(
c
*
C
lientCache
)
ClientForVersion
(
version
string
)
(
*
client
.
Client
,
error
)
{
if
client
,
ok
:=
c
.
clients
[
version
];
ok
{
if
client
,
ok
:=
c
.
clients
[
version
];
ok
{
return
client
,
nil
return
client
,
nil
}
}
...
...
pkg/kubectl/cmd/util/factory.go
View file @
01807c1f
...
@@ -49,7 +49,7 @@ const (
...
@@ -49,7 +49,7 @@ const (
// TODO: pass the various interfaces on the factory directly into the command constructors (so the
// TODO: pass the various interfaces on the factory directly into the command constructors (so the
// commands are decoupled from the factory).
// commands are decoupled from the factory).
type
Factory
struct
{
type
Factory
struct
{
clients
*
c
lientCache
clients
*
C
lientCache
flags
*
pflag
.
FlagSet
flags
*
pflag
.
FlagSet
generators
map
[
string
]
kubectl
.
Generator
generators
map
[
string
]
kubectl
.
Generator
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment