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
64985512
Commit
64985512
authored
Dec 19, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #18627 from caesarxuchao/oneline-fix
Auto commit by PR queue bot
parents
4d3f49ba
5ba4f836
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
7 deletions
+3
-7
factory.go
pkg/kubectl/cmd/util/factory.go
+1
-5
builder.go
pkg/kubectl/resource/builder.go
+2
-2
No files found.
pkg/kubectl/cmd/util/factory.go
View file @
64985512
...
@@ -175,16 +175,12 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
...
@@ -175,16 +175,12 @@ func NewFactory(optionalClientConfig clientcmd.ClientConfig) *Factory {
return
clients
.
ClientConfigForVersion
(
nil
)
return
clients
.
ClientConfigForVersion
(
nil
)
},
},
RESTClient
:
func
(
mapping
*
meta
.
RESTMapping
)
(
resource
.
RESTClient
,
error
)
{
RESTClient
:
func
(
mapping
*
meta
.
RESTMapping
)
(
resource
.
RESTClient
,
error
)
{
gvk
,
err
:=
api
.
RESTMapper
.
KindFor
(
mapping
.
Resource
)
if
err
!=
nil
{
return
nil
,
err
}
mappingVersion
:=
mapping
.
GroupVersionKind
.
GroupVersion
()
mappingVersion
:=
mapping
.
GroupVersionKind
.
GroupVersion
()
client
,
err
:=
clients
.
ClientForVersion
(
&
mappingVersion
)
client
,
err
:=
clients
.
ClientForVersion
(
&
mappingVersion
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
switch
gvk
.
Group
{
switch
mapping
.
GroupVersionKind
.
Group
{
case
api
.
GroupName
:
case
api
.
GroupName
:
return
client
.
RESTClient
,
nil
return
client
.
RESTClient
,
nil
case
extensions
.
GroupName
:
case
extensions
.
GroupName
:
...
...
pkg/kubectl/resource/builder.go
View file @
64985512
...
@@ -538,7 +538,7 @@ func (b *Builder) visitorResult() *Result {
...
@@ -538,7 +538,7 @@ func (b *Builder) visitorResult() *Result {
}
}
clients
:=
make
(
map
[
string
]
RESTClient
)
clients
:=
make
(
map
[
string
]
RESTClient
)
for
_
,
mapping
:=
range
mappings
{
for
_
,
mapping
:=
range
mappings
{
s
:=
fmt
.
Sprintf
(
"%s/%s"
,
mapping
.
APIVersion
,
mapping
.
Resource
)
s
:=
fmt
.
Sprintf
(
"%s/%s"
,
mapping
.
GroupVersionKind
.
GroupVersion
()
.
String
()
,
mapping
.
Resource
)
if
_
,
ok
:=
clients
[
s
];
ok
{
if
_
,
ok
:=
clients
[
s
];
ok
{
continue
continue
}
}
...
@@ -555,7 +555,7 @@ func (b *Builder) visitorResult() *Result {
...
@@ -555,7 +555,7 @@ func (b *Builder) visitorResult() *Result {
if
!
ok
{
if
!
ok
{
return
&
Result
{
singular
:
isSingular
,
err
:
fmt
.
Errorf
(
"resource %q is not recognized: %v"
,
tuple
.
Resource
,
mappings
)}
return
&
Result
{
singular
:
isSingular
,
err
:
fmt
.
Errorf
(
"resource %q is not recognized: %v"
,
tuple
.
Resource
,
mappings
)}
}
}
s
:=
fmt
.
Sprintf
(
"%s/%s"
,
mapping
.
APIVersion
,
mapping
.
Resource
)
s
:=
fmt
.
Sprintf
(
"%s/%s"
,
mapping
.
GroupVersionKind
.
GroupVersion
()
.
String
()
,
mapping
.
Resource
)
client
,
ok
:=
clients
[
s
]
client
,
ok
:=
clients
[
s
]
if
!
ok
{
if
!
ok
{
return
&
Result
{
singular
:
isSingular
,
err
:
fmt
.
Errorf
(
"could not find a client for resource %q"
,
tuple
.
Resource
)}
return
&
Result
{
singular
:
isSingular
,
err
:
fmt
.
Errorf
(
"could not find a client for resource %q"
,
tuple
.
Resource
)}
...
...
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