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
cb93006c
Commit
cb93006c
authored
Sep 12, 2016
by
Brian
Committed by
GitHub
Sep 12, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1154 from fibonacci1729/feat/version-opt-flag
feat(helm): add optional version flag to helm{get,status}
parents
4691251f
825d2abd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
46 additions
and
9 deletions
+46
-9
get.go
cmd/helm/get.go
+5
-1
status.go
cmd/helm/status.go
+5
-1
option.go
pkg/helm/option.go
+36
-7
No files found.
cmd/helm/get.go
View file @
cb93006c
...
...
@@ -48,6 +48,7 @@ type getCmd struct {
release
string
out
io
.
Writer
client
helm
.
Interface
version
int32
}
func
newGetCmd
(
client
helm
.
Interface
,
out
io
.
Writer
)
*
cobra
.
Command
{
...
...
@@ -71,6 +72,9 @@ func newGetCmd(client helm.Interface, out io.Writer) *cobra.Command {
return
get
.
run
()
},
}
cmd
.
PersistentFlags
()
.
Int32Var
(
&
get
.
version
,
"version"
,
0
,
"get the named release with version"
)
cmd
.
AddCommand
(
newGetValuesCmd
(
nil
,
out
))
cmd
.
AddCommand
(
newGetManifestCmd
(
nil
,
out
))
cmd
.
AddCommand
(
newGetHooksCmd
(
nil
,
out
))
...
...
@@ -96,7 +100,7 @@ MANIFEST:
// getCmd is the command that implements 'helm get'
func
(
g
*
getCmd
)
run
()
error
{
res
,
err
:=
g
.
client
.
ReleaseContent
(
g
.
release
)
res
,
err
:=
g
.
client
.
ReleaseContent
(
g
.
release
,
helm
.
ContentReleaseVersion
(
g
.
version
)
)
if
err
!=
nil
{
return
prettyError
(
err
)
}
...
...
cmd/helm/status.go
View file @
cb93006c
...
...
@@ -35,6 +35,7 @@ type statusCmd struct {
release
string
out
io
.
Writer
client
helm
.
Interface
version
int32
}
func
newStatusCmd
(
client
helm
.
Interface
,
out
io
.
Writer
)
*
cobra
.
Command
{
...
...
@@ -58,11 +59,14 @@ func newStatusCmd(client helm.Interface, out io.Writer) *cobra.Command {
return
status
.
run
()
},
}
cmd
.
PersistentFlags
()
.
Int32Var
(
&
status
.
version
,
"version"
,
0
,
"If set, display the status of the named release with version"
)
return
cmd
}
func
(
s
*
statusCmd
)
run
()
error
{
res
,
err
:=
s
.
client
.
ReleaseStatus
(
s
.
release
)
res
,
err
:=
s
.
client
.
ReleaseStatus
(
s
.
release
,
helm
.
StatusReleaseVersion
(
s
.
version
)
)
if
err
!=
nil
{
return
prettyError
(
err
)
}
...
...
pkg/helm/option.go
View file @
cb93006c
...
...
@@ -50,6 +50,10 @@ type options struct {
updateReq
rls
.
UpdateReleaseRequest
// release uninstall options are applied directly to the uninstall release request
uninstallReq
rls
.
UninstallReleaseRequest
// release get status options are applied directly to the get release status request
statusReq
rls
.
GetReleaseStatusRequest
// release get content options are applied directly to the get release content request
contentReq
rls
.
GetReleaseContentRequest
}
// Home specifies the location of helm home, (default = "$HOME/.helm").
...
...
@@ -198,13 +202,32 @@ func InstallReuseName(reuse bool) InstallOption {
}
}
// ContentOption -- TODO
// ContentOption allows setting optional attributes when
// performing a GetReleaseContent tiller rpc.
type
ContentOption
func
(
*
options
)
// StatusOption -- TODO
// ContentReleaseVersion will instruct Tiller to retrieve the content
// of a paritcular version of a release.
func
ContentReleaseVersion
(
version
int32
)
ContentOption
{
return
func
(
opts
*
options
)
{
opts
.
contentReq
.
Version
=
version
}
}
// StatusOption allows setting optional attributes when
// performing a GetReleaseStatus tiller rpc.
type
StatusOption
func
(
*
options
)
// DeleteOption -- TODO
// StatusReleaseVersion will instruct Tiller to retrieve the status
// of a paritcular version of a release.
func
StatusReleaseVersion
(
version
int32
)
StatusOption
{
return
func
(
opts
*
options
)
{
opts
.
statusReq
.
Version
=
version
}
}
// DeleteOption allows setting optional attributes when
// performing a UninstallRelease tiller rpc.
type
DeleteOption
func
(
*
options
)
// UpdateOption allows specifying various settings
...
...
@@ -281,12 +304,18 @@ func (o *options) rpcUpdateRelease(rlsName string, chr *cpb.Chart, rlc rls.Relea
// Executes tiller.GetReleaseStatus RPC.
func
(
o
*
options
)
rpcGetReleaseStatus
(
rlsName
string
,
rlc
rls
.
ReleaseServiceClient
,
opts
...
StatusOption
)
(
*
rls
.
GetReleaseStatusResponse
,
error
)
{
req
:=
&
rls
.
GetReleaseStatusRequest
{
Name
:
rlsName
}
return
rlc
.
GetReleaseStatus
(
context
.
TODO
(),
req
)
for
_
,
opt
:=
range
opts
{
opt
(
o
)
}
o
.
statusReq
.
Name
=
rlsName
return
rlc
.
GetReleaseStatus
(
context
.
TODO
(),
&
o
.
statusReq
)
}
// Executes tiller.GetReleaseContent.
func
(
o
*
options
)
rpcGetReleaseContent
(
rlsName
string
,
rlc
rls
.
ReleaseServiceClient
,
opts
...
ContentOption
)
(
*
rls
.
GetReleaseContentResponse
,
error
)
{
req
:=
&
rls
.
GetReleaseContentRequest
{
Name
:
rlsName
}
return
rlc
.
GetReleaseContent
(
context
.
TODO
(),
req
)
for
_
,
opt
:=
range
opts
{
opt
(
o
)
}
o
.
contentReq
.
Name
=
rlsName
return
rlc
.
GetReleaseContent
(
context
.
TODO
(),
&
o
.
contentReq
)
}
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