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
918df97a
Unverified
Commit
918df97a
authored
May 03, 2018
by
Jordan Liggitt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow api-resources to return cached data
parent
74b7cec0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
apiresources.go
pkg/kubectl/cmd/apiresources.go
+6
-2
No files found.
pkg/kubectl/cmd/apiresources.go
View file @
918df97a
...
@@ -59,6 +59,7 @@ type ApiResourcesOptions struct {
...
@@ -59,6 +59,7 @@ type ApiResourcesOptions struct {
Namespaced
bool
Namespaced
bool
Verbs
[]
string
Verbs
[]
string
NoHeaders
bool
NoHeaders
bool
Cached
bool
genericclioptions
.
IOStreams
genericclioptions
.
IOStreams
}
}
...
@@ -94,6 +95,7 @@ func NewCmdApiResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
...
@@ -94,6 +95,7 @@ func NewCmdApiResources(f cmdutil.Factory, ioStreams genericclioptions.IOStreams
cmd
.
Flags
()
.
StringVar
(
&
o
.
APIGroup
,
"api-group"
,
""
,
"Limit to resources in the specified API group."
)
cmd
.
Flags
()
.
StringVar
(
&
o
.
APIGroup
,
"api-group"
,
""
,
"Limit to resources in the specified API group."
)
cmd
.
Flags
()
.
BoolVar
(
&
o
.
Namespaced
,
"namespaced"
,
true
,
"Namespaced indicates if a resource is namespaced or not."
)
cmd
.
Flags
()
.
BoolVar
(
&
o
.
Namespaced
,
"namespaced"
,
true
,
"Namespaced indicates if a resource is namespaced or not."
)
cmd
.
Flags
()
.
StringSliceVar
(
&
o
.
Verbs
,
"verbs"
,
o
.
Verbs
,
"Limit to resources that support the specified verbs."
)
cmd
.
Flags
()
.
StringSliceVar
(
&
o
.
Verbs
,
"verbs"
,
o
.
Verbs
,
"Limit to resources that support the specified verbs."
)
cmd
.
Flags
()
.
BoolVar
(
&
o
.
Cached
,
"cached"
,
o
.
Cached
,
"Use the cached list of resources if available."
)
return
cmd
return
cmd
}
}
...
@@ -125,8 +127,10 @@ func (o *ApiResourcesOptions) RunApiResources(cmd *cobra.Command, f cmdutil.Fact
...
@@ -125,8 +127,10 @@ func (o *ApiResourcesOptions) RunApiResources(cmd *cobra.Command, f cmdutil.Fact
return
err
return
err
}
}
// Always request fresh data from the server
if
!
o
.
Cached
{
discoveryclient
.
Invalidate
()
// Always request fresh data from the server
discoveryclient
.
Invalidate
()
}
lists
,
err
:=
discoveryclient
.
ServerPreferredResources
()
lists
,
err
:=
discoveryclient
.
ServerPreferredResources
()
if
err
!=
nil
{
if
err
!=
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