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
c7efab40
Commit
c7efab40
authored
Jan 24, 2018
by
Maciej Szulik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix kubectl explain for cronjobs
parent
2f4cca73
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
16 deletions
+9
-16
test-cmd-util.sh
hack/make-rules/test-cmd-util.sh
+2
-0
explain.go
pkg/kubectl/cmd/explain.go
+7
-16
No files found.
hack/make-rules/test-cmd-util.sh
View file @
c7efab40
...
...
@@ -4120,6 +4120,8 @@ run_kubectl_explain_tests() {
# shortcuts work
kubectl explain po
kubectl explain po.status.message
# cronjob work
kubectl explain cronjob
set
+o nounset
set
+o errexit
...
...
pkg/kubectl/cmd/explain.go
View file @
c7efab40
...
...
@@ -26,19 +26,18 @@ import (
"k8s.io/kubernetes/pkg/kubectl/cmd/templates"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
"k8s.io/kubernetes/pkg/kubectl/explain"
"k8s.io/kubernetes/pkg/kubectl/scheme"
"k8s.io/kubernetes/pkg/kubectl/util/i18n"
)
var
(
explainLong
=
templates
.
LongDesc
(
`
List the fields for supported resources
This command describes the fields associated with each supported API resource.
Fields are identified via a simple JSONPath identifier:
Fields are identified via a simple JSONPath identifier:
<type>.<fieldName>[.<fieldName>]
Add the --recursive flag to display all of the fields at once without descriptions.
Information about each field is retrieved from the server in OpenAPI format.`
)
...
...
@@ -81,7 +80,6 @@ func RunExplain(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, ar
recursive
:=
cmdutil
.
GetFlagBool
(
cmd
,
"recursive"
)
apiVersionString
:=
cmdutil
.
GetFlagString
(
cmd
,
"api-version"
)
apiVersion
:=
schema
.
GroupVersion
{}
mapper
,
_
:=
f
.
Object
()
// TODO: After we figured out the new syntax to separate group and resource, allow
...
...
@@ -105,20 +103,13 @@ func RunExplain(f cmdutil.Factory, out, cmdErr io.Writer, cmd *cobra.Command, ar
}
}
if
len
(
apiVersionString
)
==
0
{
groupMeta
,
err
:=
scheme
.
Registry
.
Group
(
gvk
.
Group
)
if
err
!=
nil
{
return
err
}
apiVersion
=
groupMeta
.
GroupVersion
}
else
{
apiVersion
,
err
=
schema
.
ParseGroupVersion
(
apiVersionString
)
if
len
(
apiVersionString
)
!=
0
{
apiVersion
,
err
:=
schema
.
ParseGroupVersion
(
apiVersionString
)
if
err
!=
nil
{
return
err
}
gvk
=
apiVersion
.
WithKind
(
gvk
.
Kind
)
}
gvk
=
apiVersion
.
WithKind
(
gvk
.
Kind
)
resources
,
err
:=
f
.
OpenAPISchema
()
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