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
6be1b975
Commit
6be1b975
authored
Dec 21, 2017
by
Zhenguo Niu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make REST mappings for resources a unique list
This ensures the mappings list for resources(shortcuts, plural) unique, instead of doing multiple requests to server for the same resource.
parent
8f4f07fc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
builder.go
pkg/kubectl/resource/builder.go
+6
-0
No files found.
pkg/kubectl/resource/builder.go
View file @
6be1b975
...
...
@@ -622,11 +622,17 @@ func (b *Builder) resourceMappings() ([]*meta.RESTMapping, error) {
return
nil
,
fmt
.
Errorf
(
"you may only specify a single resource type"
)
}
mappings
:=
[]
*
meta
.
RESTMapping
{}
seen
:=
map
[
schema
.
GroupVersionKind
]
bool
{}
for
_
,
r
:=
range
b
.
resources
{
mapping
,
err
:=
b
.
mappingFor
(
r
)
if
err
!=
nil
{
return
nil
,
err
}
// This ensures the mappings for resources(shortcuts, plural) unique
if
seen
[
mapping
.
GroupVersionKind
]
{
continue
}
seen
[
mapping
.
GroupVersionKind
]
=
true
mappings
=
append
(
mappings
,
mapping
)
}
...
...
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