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
570a9dc1
Commit
570a9dc1
authored
Oct 24, 2015
by
k8s-merge-robot
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #15796 from caesarxuchao/fix-kubectl-api-versions
Auto commit by PR queue bot
parents
c291eb54
eb3a8015
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
20 additions
and
27 deletions
+20
-27
kubectl-api-versions.1
docs/man/man1/kubectl-api-versions.1
+2
-2
kubectl.md
docs/user-guide/kubectl/kubectl.md
+2
-2
kubectl_api-versions.md
docs/user-guide/kubectl/kubectl_api-versions.md
+3
-3
client.go
pkg/client/unversioned/client.go
+1
-1
discovery_client.go
pkg/client/unversioned/discovery_client.go
+1
-1
helper.go
pkg/client/unversioned/helper.go
+2
-2
apiversions.go
pkg/kubectl/cmd/apiversions.go
+9
-13
kubectl.go
test/e2e/kubectl.go
+0
-3
No files found.
docs/man/man1/kubectl-api-versions.1
View file @
570a9dc1
...
...
@@ -3,7 +3,7 @@
.SH NAME
.PP
kubectl api\-versions \- Print
available API versions
.
kubectl api\-versions \- Print
the supported API versions on the server, in the form of "group/version"
.
.SH SYNOPSIS
...
...
@@ -13,7 +13,7 @@ kubectl api\-versions \- Print available API versions.
.SH DESCRIPTION
.PP
Print
available API versions
.
Print
the supported API versions on the server, in the form of "group/version"
.
.SH OPTIONS INHERITED FROM PARENT COMMANDS
...
...
docs/user-guide/kubectl/kubectl.md
View file @
570a9dc1
...
...
@@ -77,7 +77,7 @@ kubectl
### SEE ALSO
*
[
kubectl annotate
](
kubectl_annotate.md
)
- Update the annotations on a resource
*
[
kubectl api-versions
](
kubectl_api-versions.md
)
- Print
available API versions
.
*
[
kubectl api-versions
](
kubectl_api-versions.md
)
- Print
the supported API versions on the server, in the form of "group/version"
.
*
[
kubectl apply
](
kubectl_apply.md
)
- Apply a configuration to a resource by filename or stdin
*
[
kubectl attach
](
kubectl_attach.md
)
- Attach to a running container.
*
[
kubectl autoscale
](
kubectl_autoscale.md
)
- Auto-scale a replication controller
...
...
@@ -105,7 +105,7 @@ kubectl
*
[
kubectl stop
](
kubectl_stop.md
)
- Deprecated: Gracefully shut down a resource by name or filename.
*
[
kubectl version
](
kubectl_version.md
)
- Print the client and server version information.
###### Auto generated by spf13/cobra on
16
-Oct-2015
###### Auto generated by spf13/cobra on
21
-Oct-2015
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[

]()
...
...
docs/user-guide/kubectl/kubectl_api-versions.md
View file @
570a9dc1
...
...
@@ -33,12 +33,12 @@ Documentation for other releases can be found at
## kubectl api-versions
Print
available API versions
.
Print
the supported API versions on the server, in the form of "group/version"
.
### Synopsis
Print
available API versions
.
Print
the supported API versions on the server, in the form of "group/version"
.
```
kubectl api-versions
...
...
@@ -76,7 +76,7 @@ kubectl api-versions
*
[
kubectl
](
kubectl.md
)
- kubectl controls the Kubernetes cluster manager
###### Auto generated by spf13/cobra
at 2015-09-22 12:53:42.294634813 +0000 UTC
###### Auto generated by spf13/cobra
on 20-Oct-2015
<!-- BEGIN MUNGE: GENERATED_ANALYTICS -->
[

]()
...
...
pkg/client/unversioned/client.go
View file @
570a9dc1
...
...
@@ -196,7 +196,7 @@ func (c *Client) SwaggerSchema(groupVersion string) (*swagger.ApiDeclaration, er
if
err
!=
nil
{
return
nil
,
err
}
groupVersions
:=
e
xtractGroupVersions
(
groupList
)
groupVersions
:=
E
xtractGroupVersions
(
groupList
)
// This check also takes care the case that kubectl is newer than the running endpoint
if
stringDoesntExistIn
(
groupVersion
,
groupVersions
)
{
return
nil
,
fmt
.
Errorf
(
"API version: %s is not supported by the server. Use one of: %v"
,
groupVersion
,
groupVersions
)
...
...
pkg/client/unversioned/discovery_client.go
View file @
570a9dc1
...
...
@@ -140,7 +140,7 @@ func (d *DiscoveryClient) ServerResources() (map[string]*unversioned.APIResource
if
err
!=
nil
{
return
nil
,
err
}
groupVersions
:=
e
xtractGroupVersions
(
apiGroups
)
groupVersions
:=
E
xtractGroupVersions
(
apiGroups
)
result
:=
map
[
string
]
*
unversioned
.
APIResourceList
{}
for
_
,
groupVersion
:=
range
groupVersions
{
resources
,
err
:=
d
.
ServerResourcesForGroupVersion
(
groupVersion
)
...
...
pkg/client/unversioned/helper.go
View file @
570a9dc1
...
...
@@ -187,7 +187,7 @@ func MatchesServerVersion(client *Client, c *Config) error {
return
nil
}
func
e
xtractGroupVersions
(
l
*
unversioned
.
APIGroupList
)
[]
string
{
func
E
xtractGroupVersions
(
l
*
unversioned
.
APIGroupList
)
[]
string
{
var
groupVersions
[]
string
for
_
,
g
:=
range
l
.
Groups
{
for
_
,
gv
:=
range
g
.
Versions
{
...
...
@@ -241,7 +241,7 @@ func ServerAPIVersions(c *Config) (groupVersions []string, err error) {
if
err
!=
nil
{
return
nil
,
fmt
.
Errorf
(
"unexpected error: %v"
,
err
)
}
groupVersions
=
append
(
groupVersions
,
e
xtractGroupVersions
(
&
apiGroupList
)
...
)
groupVersions
=
append
(
groupVersions
,
E
xtractGroupVersions
(
&
apiGroupList
)
...
)
return
groupVersions
,
nil
}
...
...
pkg/kubectl/cmd/apiversions.go
View file @
570a9dc1
...
...
@@ -20,10 +20,11 @@ import (
"fmt"
"io"
"os"
"sort"
"github.com/spf13/cobra"
"k8s.io/kubernetes/pkg/api
/unversioned"
unversioned_client
"k8s.io/kubernetes/pkg/client
/unversioned"
cmdutil
"k8s.io/kubernetes/pkg/kubectl/cmd/util"
)
...
...
@@ -32,7 +33,7 @@ func NewCmdApiVersions(f *cmdutil.Factory, out io.Writer) *cobra.Command {
Use
:
"api-versions"
,
// apiversions is deprecated.
Aliases
:
[]
string
{
"apiversions"
},
Short
:
"Print
available API versions
."
,
Short
:
"Print
the supported API versions on the server, in the form of
\"
group/version
\"
."
,
Run
:
func
(
cmd
*
cobra
.
Command
,
args
[]
string
)
{
err
:=
RunApiVersions
(
f
,
out
)
cmdutil
.
CheckErr
(
err
)
...
...
@@ -51,19 +52,14 @@ func RunApiVersions(f *cmdutil.Factory, w io.Writer) error {
return
err
}
apiVersions
,
err
:=
client
.
ServerAPIVersion
s
()
groupList
,
err
:=
client
.
Discovery
()
.
ServerGroup
s
()
if
err
!=
nil
{
fmt
.
Printf
(
"Couldn't get available api versions from server: %v
\n
"
,
err
)
os
.
Exit
(
1
)
return
fmt
.
Errorf
(
"Couldn't get available api versions from server: %v
\n
"
,
err
)
}
var
expAPIVersions
*
unversioned
.
APIVersions
expAPIVersions
,
err
=
client
.
Extensions
()
.
ServerAPIVersions
()
fmt
.
Fprintf
(
w
,
"Available Server Api Versions: %#v
\n
"
,
*
apiVersions
)
if
err
==
nil
{
fmt
.
Fprintf
(
w
,
"Available Server Experimental Api Versions: %#v
\n
"
,
*
expAPIVersions
)
apiVersions
:=
unversioned_client
.
ExtractGroupVersions
(
groupList
)
sort
.
Strings
(
apiVersions
)
for
_
,
v
:=
range
apiVersions
{
fmt
.
Fprintln
(
w
,
v
)
}
return
nil
}
test/e2e/kubectl.go
View file @
570a9dc1
...
...
@@ -438,9 +438,6 @@ var _ = Describe("Kubectl client", func() {
It
(
"should check if v1 is in available api versions [Conformance]"
,
func
()
{
By
(
"validating api verions"
)
output
:=
runKubectl
(
"api-versions"
)
if
!
strings
.
Contains
(
output
,
"Available Server Api Versions:"
)
{
Failf
(
"Missing caption in kubectl api-versions"
)
}
if
!
strings
.
Contains
(
output
,
"v1"
)
{
Failf
(
"No v1 in kubectl api-versions"
)
}
...
...
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