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
999273fb
Unverified
Commit
999273fb
authored
Feb 22, 2018
by
Maciej Szulik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove ClientSetForVersion & ClientConfigForVersion from factory
parent
270148d7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
34 deletions
+6
-34
fake.go
pkg/kubectl/cmd/testing/fake.go
+0
-11
factory.go
pkg/kubectl/cmd/util/factory.go
+0
-5
factory_client_access.go
pkg/kubectl/cmd/util/factory_client_access.go
+0
-8
factory_object_mapping.go
pkg/kubectl/cmd/util/factory_object_mapping.go
+5
-9
factory_object_mapping_test.go
pkg/kubectl/cmd/util/factory_object_mapping_test.go
+1
-1
No files found.
pkg/kubectl/cmd/testing/fake.go
View file @
999273fb
...
@@ -322,13 +322,6 @@ func (f *FakeFactory) ClientForMapping(mapping *meta.RESTMapping) (resource.REST
...
@@ -322,13 +322,6 @@ func (f *FakeFactory) ClientForMapping(mapping *meta.RESTMapping) (resource.REST
return
f
.
tf
.
Client
,
f
.
tf
.
Err
return
f
.
tf
.
Client
,
f
.
tf
.
Err
}
}
func
(
f
*
FakeFactory
)
ClientSetForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
internalclientset
.
Interface
,
error
)
{
return
nil
,
nil
}
func
(
f
*
FakeFactory
)
ClientConfigForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
*
restclient
.
Config
,
error
)
{
return
nil
,
nil
}
func
(
f
*
FakeFactory
)
UnstructuredClientForMapping
(
mapping
*
meta
.
RESTMapping
)
(
resource
.
RESTClient
,
error
)
{
func
(
f
*
FakeFactory
)
UnstructuredClientForMapping
(
mapping
*
meta
.
RESTMapping
)
(
resource
.
RESTClient
,
error
)
{
if
f
.
tf
.
UnstructuredClientForMappingFunc
!=
nil
{
if
f
.
tf
.
UnstructuredClientForMappingFunc
!=
nil
{
return
f
.
tf
.
UnstructuredClientForMappingFunc
(
mapping
)
return
f
.
tf
.
UnstructuredClientForMappingFunc
(
mapping
)
...
@@ -606,10 +599,6 @@ func (f *fakeAPIFactory) CategoryExpander() categories.CategoryExpander {
...
@@ -606,10 +599,6 @@ func (f *fakeAPIFactory) CategoryExpander() categories.CategoryExpander {
return
f
.
Factory
.
CategoryExpander
()
return
f
.
Factory
.
CategoryExpander
()
}
}
func
(
f
*
fakeAPIFactory
)
ClientSetForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
internalclientset
.
Interface
,
error
)
{
return
f
.
ClientSet
()
}
func
(
f
*
fakeAPIFactory
)
ClientConfig
()
(
*
restclient
.
Config
,
error
)
{
func
(
f
*
fakeAPIFactory
)
ClientConfig
()
(
*
restclient
.
Config
,
error
)
{
return
f
.
tf
.
ClientConfig
,
f
.
tf
.
Err
return
f
.
tf
.
ClientConfig
,
f
.
tf
.
Err
}
}
...
...
pkg/kubectl/cmd/util/factory.go
View file @
999273fb
...
@@ -106,11 +106,6 @@ type ClientAccessFactory interface {
...
@@ -106,11 +106,6 @@ type ClientAccessFactory interface {
// just directions to the server. People use this to build RESTMappers on top of
// just directions to the server. People use this to build RESTMappers on top of
BareClientConfig
()
(
*
restclient
.
Config
,
error
)
BareClientConfig
()
(
*
restclient
.
Config
,
error
)
// TODO remove. This should be rolled into `ClientSet`
ClientSetForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
internalclientset
.
Interface
,
error
)
// TODO remove. This should be rolled into `ClientConfig`
ClientConfigForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
*
restclient
.
Config
,
error
)
// UpdatePodSpecForObject will call the provided function on the pod spec this object supports,
// UpdatePodSpecForObject will call the provided function on the pod spec this object supports,
// return false if no pod spec is supported, or return an error.
// return false if no pod spec is supported, or return an error.
UpdatePodSpecForObject
(
obj
runtime
.
Object
,
fn
func
(
*
v1
.
PodSpec
)
error
)
(
bool
,
error
)
UpdatePodSpecForObject
(
obj
runtime
.
Object
,
fn
func
(
*
v1
.
PodSpec
)
error
)
(
bool
,
error
)
...
...
pkg/kubectl/cmd/util/factory_client_access.go
View file @
999273fb
...
@@ -208,10 +208,6 @@ func (f *ring0Factory) ClientSet() (internalclientset.Interface, error) {
...
@@ -208,10 +208,6 @@ func (f *ring0Factory) ClientSet() (internalclientset.Interface, error) {
return
f
.
clientCache
.
ClientSetForVersion
(
nil
)
return
f
.
clientCache
.
ClientSetForVersion
(
nil
)
}
}
func
(
f
*
ring0Factory
)
ClientSetForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
internalclientset
.
Interface
,
error
)
{
return
f
.
clientCache
.
ClientSetForVersion
(
requiredVersion
)
}
func
(
f
*
ring0Factory
)
ClientConfig
()
(
*
restclient
.
Config
,
error
)
{
func
(
f
*
ring0Factory
)
ClientConfig
()
(
*
restclient
.
Config
,
error
)
{
return
f
.
clientCache
.
ClientConfigForVersion
(
nil
)
return
f
.
clientCache
.
ClientConfigForVersion
(
nil
)
}
}
...
@@ -219,10 +215,6 @@ func (f *ring0Factory) BareClientConfig() (*restclient.Config, error) {
...
@@ -219,10 +215,6 @@ func (f *ring0Factory) BareClientConfig() (*restclient.Config, error) {
return
f
.
clientConfig
.
ClientConfig
()
return
f
.
clientConfig
.
ClientConfig
()
}
}
func
(
f
*
ring0Factory
)
ClientConfigForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
*
restclient
.
Config
,
error
)
{
return
f
.
clientCache
.
ClientConfigForVersion
(
nil
)
}
func
(
f
*
ring0Factory
)
RESTClient
()
(
*
restclient
.
RESTClient
,
error
)
{
func
(
f
*
ring0Factory
)
RESTClient
()
(
*
restclient
.
RESTClient
,
error
)
{
clientConfig
,
err
:=
f
.
clientCache
.
ClientConfigForVersion
(
nil
)
clientConfig
,
err
:=
f
.
clientCache
.
ClientConfigForVersion
(
nil
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
pkg/kubectl/cmd/util/factory_object_mapping.go
View file @
999273fb
...
@@ -166,9 +166,7 @@ func (f *ring1Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (
...
@@ -166,9 +166,7 @@ func (f *ring1Factory) UnstructuredClientForMapping(mapping *meta.RESTMapping) (
}
}
func
(
f
*
ring1Factory
)
Describer
(
mapping
*
meta
.
RESTMapping
)
(
printers
.
Describer
,
error
)
{
func
(
f
*
ring1Factory
)
Describer
(
mapping
*
meta
.
RESTMapping
)
(
printers
.
Describer
,
error
)
{
mappingVersion
:=
mapping
.
GroupVersionKind
.
GroupVersion
()
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
()
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSetForVersion
(
&
mappingVersion
)
if
err
!=
nil
{
if
err
!=
nil
{
// if we can't make a client for this group/version, go generic if possible
// if we can't make a client for this group/version, go generic if possible
if
genericDescriber
,
genericErr
:=
genericDescriber
(
f
.
clientAccessFactory
,
mapping
);
genericErr
==
nil
{
if
genericDescriber
,
genericErr
:=
genericDescriber
(
f
.
clientAccessFactory
,
mapping
);
genericErr
==
nil
{
...
@@ -219,7 +217,7 @@ func genericDescriber(clientAccessFactory ClientAccessFactory, mapping *meta.RES
...
@@ -219,7 +217,7 @@ func genericDescriber(clientAccessFactory ClientAccessFactory, mapping *meta.RES
}
}
func
(
f
*
ring1Factory
)
LogsForObject
(
object
,
options
runtime
.
Object
,
timeout
time
.
Duration
)
(
*
restclient
.
Request
,
error
)
{
func
(
f
*
ring1Factory
)
LogsForObject
(
object
,
options
runtime
.
Object
,
timeout
time
.
Duration
)
(
*
restclient
.
Request
,
error
)
{
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
ForVersion
(
nil
)
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
(
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -282,8 +280,7 @@ func (f *ring1Factory) LogsForObject(object, options runtime.Object, timeout tim
...
@@ -282,8 +280,7 @@ func (f *ring1Factory) LogsForObject(object, options runtime.Object, timeout tim
}
}
func
(
f
*
ring1Factory
)
Scaler
(
mapping
*
meta
.
RESTMapping
)
(
kubectl
.
Scaler
,
error
)
{
func
(
f
*
ring1Factory
)
Scaler
(
mapping
*
meta
.
RESTMapping
)
(
kubectl
.
Scaler
,
error
)
{
mappingVersion
:=
mapping
.
GroupVersionKind
.
GroupVersion
()
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
()
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSetForVersion
(
&
mappingVersion
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
@@ -307,8 +304,7 @@ func (f *ring1Factory) Scaler(mapping *meta.RESTMapping) (kubectl.Scaler, error)
...
@@ -307,8 +304,7 @@ func (f *ring1Factory) Scaler(mapping *meta.RESTMapping) (kubectl.Scaler, error)
}
}
func
(
f
*
ring1Factory
)
Reaper
(
mapping
*
meta
.
RESTMapping
)
(
kubectl
.
Reaper
,
error
)
{
func
(
f
*
ring1Factory
)
Reaper
(
mapping
*
meta
.
RESTMapping
)
(
kubectl
.
Reaper
,
error
)
{
mappingVersion
:=
mapping
.
GroupVersionKind
.
GroupVersion
()
clientset
,
clientsetErr
:=
f
.
clientAccessFactory
.
ClientSet
()
clientset
,
clientsetErr
:=
f
.
clientAccessFactory
.
ClientSetForVersion
(
&
mappingVersion
)
reaper
,
reaperErr
:=
kubectl
.
ReaperFor
(
mapping
.
GroupVersionKind
.
GroupKind
(),
clientset
)
reaper
,
reaperErr
:=
kubectl
.
ReaperFor
(
mapping
.
GroupVersionKind
.
GroupKind
(),
clientset
)
if
kubectl
.
IsNoSuchReaperError
(
reaperErr
)
{
if
kubectl
.
IsNoSuchReaperError
(
reaperErr
)
{
...
@@ -367,7 +363,7 @@ func (f *ring1Factory) ApproximatePodTemplateForObject(object runtime.Object) (*
...
@@ -367,7 +363,7 @@ func (f *ring1Factory) ApproximatePodTemplateForObject(object runtime.Object) (*
}
}
func
(
f
*
ring1Factory
)
AttachablePodForObject
(
object
runtime
.
Object
,
timeout
time
.
Duration
)
(
*
api
.
Pod
,
error
)
{
func
(
f
*
ring1Factory
)
AttachablePodForObject
(
object
runtime
.
Object
,
timeout
time
.
Duration
)
(
*
api
.
Pod
,
error
)
{
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
ForVersion
(
nil
)
clientset
,
err
:=
f
.
clientAccessFactory
.
ClientSet
(
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
...
...
pkg/kubectl/cmd/util/factory_object_mapping_test.go
View file @
999273fb
...
@@ -40,7 +40,7 @@ type fakeClientAccessFactory struct {
...
@@ -40,7 +40,7 @@ type fakeClientAccessFactory struct {
fakeClientset
*
fake
.
Clientset
fakeClientset
*
fake
.
Clientset
}
}
func
(
f
*
fakeClientAccessFactory
)
ClientSet
ForVersion
(
requiredVersion
*
schema
.
GroupVersion
)
(
internalclientset
.
Interface
,
error
)
{
func
(
f
*
fakeClientAccessFactory
)
ClientSet
(
)
(
internalclientset
.
Interface
,
error
)
{
return
f
.
fakeClientset
,
nil
return
f
.
fakeClientset
,
nil
}
}
...
...
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