Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
5decaa24
Unverified
Commit
5decaa24
authored
Dec 28, 2017
by
Matthew Fisher
Committed by
GitHub
Dec 28, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2754 from rbwsam/feat/get_kube_ver
feat(*): add k8s version to version debug cmd
parents
55ab4b86
558dcf3c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
1 deletion
+19
-1
version.go
cmd/helm/version.go
+19
-1
No files found.
cmd/helm/version.go
View file @
5decaa24
...
...
@@ -25,6 +25,7 @@ import (
"google.golang.org/grpc"
"google.golang.org/grpc/codes"
apiVersion
"k8s.io/apimachinery/pkg/version"
"k8s.io/helm/pkg/helm"
pb
"k8s.io/helm/pkg/proto/hapi/version"
"k8s.io/helm/pkg/version"
...
...
@@ -89,7 +90,6 @@ func newVersionCmd(c helm.Interface, out io.Writer) *cobra.Command {
}
func
(
v
*
versionCmd
)
run
()
error
{
if
v
.
showClient
{
cv
:=
version
.
GetVersionProto
()
fmt
.
Fprintf
(
v
.
out
,
"Client: %s
\n
"
,
formatVersion
(
cv
,
v
.
short
))
...
...
@@ -99,6 +99,14 @@ func (v *versionCmd) run() error {
return
nil
}
if
settings
.
Debug
{
k8sVersion
,
err
:=
getK8sVersion
()
if
err
!=
nil
{
return
err
}
fmt
.
Fprintf
(
v
.
out
,
"Kubernetes: %#v
\n
"
,
k8sVersion
)
}
resp
,
err
:=
v
.
client
.
GetVersion
()
if
err
!=
nil
{
if
grpc
.
Code
(
err
)
==
codes
.
Unimplemented
{
...
...
@@ -111,6 +119,16 @@ func (v *versionCmd) run() error {
return
nil
}
func
getK8sVersion
()
(
*
apiVersion
.
Info
,
error
)
{
var
v
*
apiVersion
.
Info
_
,
client
,
err
:=
getKubeClient
(
settings
.
KubeContext
)
if
err
!=
nil
{
return
v
,
err
}
v
,
err
=
client
.
Discovery
()
.
ServerVersion
()
return
v
,
err
}
func
formatVersion
(
v
*
pb
.
Version
,
short
bool
)
string
{
if
short
{
return
fmt
.
Sprintf
(
"%s+g%s"
,
v
.
SemVer
,
v
.
GitCommit
[
:
7
])
...
...
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