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
84e7abca
Commit
84e7abca
authored
Mar 29, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(cli) add kubectl path option
parent
fc40bc8d
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
6 deletions
+20
-6
helm.go
cmd/helm/helm.go
+6
-1
server.go
cmd/helm/server.go
+14
-5
No files found.
cmd/helm/helm.go
View file @
84e7abca
...
@@ -70,10 +70,15 @@ func main() {
...
@@ -70,10 +70,15 @@ func main() {
app
.
Flags
=
[]
cli
.
Flag
{
app
.
Flags
=
[]
cli
.
Flag
{
cli
.
StringFlag
{
cli
.
StringFlag
{
Name
:
"host,u"
,
Name
:
"host,u"
,
Usage
:
"The URL of the DM server
.
"
,
Usage
:
"The URL of the DM server"
,
EnvVar
:
"HELM_HOST"
,
EnvVar
:
"HELM_HOST"
,
Value
:
"https://localhost:8000/"
,
Value
:
"https://localhost:8000/"
,
},
},
cli
.
StringFlag
{
Name
:
"kubectl"
,
Usage
:
"The path to the kubectl binary"
,
EnvVar
:
"KUBECTL"
,
},
cli
.
IntFlag
{
cli
.
IntFlag
{
Name
:
"timeout"
,
Name
:
"timeout"
,
Usage
:
"Time in seconds to wait for response"
,
Usage
:
"Time in seconds to wait for response"
,
...
...
cmd/helm/server.go
View file @
84e7abca
...
@@ -128,7 +128,8 @@ func installServer(c *cli.Context) error {
...
@@ -128,7 +128,8 @@ func installServer(c *cli.Context) error {
manImg
:=
c
.
String
(
"manager-image"
)
manImg
:=
c
.
String
(
"manager-image"
)
dryRun
:=
c
.
Bool
(
"dry-run"
)
dryRun
:=
c
.
Bool
(
"dry-run"
)
runner
:=
buildKubectlRunner
(
dryRun
)
kubectlPath
:=
c
.
String
(
"kubectl"
)
runner
:=
buildKubectlRunner
(
kubectlPath
,
dryRun
)
i
:=
client
.
NewInstaller
()
i
:=
client
.
NewInstaller
()
i
.
Manager
[
"Image"
]
=
manImg
i
.
Manager
[
"Image"
]
=
manImg
...
@@ -145,7 +146,8 @@ func installServer(c *cli.Context) error {
...
@@ -145,7 +146,8 @@ func installServer(c *cli.Context) error {
func
uninstallServer
(
c
*
cli
.
Context
)
error
{
func
uninstallServer
(
c
*
cli
.
Context
)
error
{
dryRun
:=
c
.
Bool
(
"dry-run"
)
dryRun
:=
c
.
Bool
(
"dry-run"
)
runner
:=
buildKubectlRunner
(
dryRun
)
kubectlPath
:=
c
.
String
(
"kubectl"
)
runner
:=
buildKubectlRunner
(
kubectlPath
,
dryRun
)
out
,
err
:=
client
.
Uninstall
(
runner
)
out
,
err
:=
client
.
Uninstall
(
runner
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -157,7 +159,8 @@ func uninstallServer(c *cli.Context) error {
...
@@ -157,7 +159,8 @@ func uninstallServer(c *cli.Context) error {
func
statusServer
(
c
*
cli
.
Context
)
error
{
func
statusServer
(
c
*
cli
.
Context
)
error
{
dryRun
:=
c
.
Bool
(
"dry-run"
)
dryRun
:=
c
.
Bool
(
"dry-run"
)
runner
:=
buildKubectlRunner
(
dryRun
)
kubectlPath
:=
c
.
String
(
"kubectl"
)
runner
:=
buildKubectlRunner
(
kubectlPath
,
dryRun
)
out
,
err
:=
runner
.
GetByKind
(
"pods"
,
""
,
"dm"
)
out
,
err
:=
runner
.
GetByKind
(
"pods"
,
""
,
"dm"
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -169,7 +172,9 @@ func statusServer(c *cli.Context) error {
...
@@ -169,7 +172,9 @@ func statusServer(c *cli.Context) error {
func
targetServer
(
c
*
cli
.
Context
)
error
{
func
targetServer
(
c
*
cli
.
Context
)
error
{
dryRun
:=
c
.
Bool
(
"dry-run"
)
dryRun
:=
c
.
Bool
(
"dry-run"
)
runner
:=
buildKubectlRunner
(
dryRun
)
kubectlPath
:=
c
.
String
(
"kubectl"
)
runner
:=
buildKubectlRunner
(
kubectlPath
,
dryRun
)
out
,
err
:=
runner
.
ClusterInfo
()
out
,
err
:=
runner
.
ClusterInfo
()
if
err
!=
nil
{
if
err
!=
nil
{
return
fmt
.
Errorf
(
"%s (%s)"
,
out
,
err
)
return
fmt
.
Errorf
(
"%s (%s)"
,
out
,
err
)
...
@@ -178,9 +183,13 @@ func targetServer(c *cli.Context) error {
...
@@ -178,9 +183,13 @@ func targetServer(c *cli.Context) error {
return
nil
return
nil
}
}
func
buildKubectlRunner
(
dryRun
bool
)
kubectl
.
Runner
{
func
buildKubectlRunner
(
kubectlPath
string
,
dryRun
bool
)
kubectl
.
Runner
{
if
dryRun
{
if
dryRun
{
return
&
kubectl
.
PrintRunner
{}
return
&
kubectl
.
PrintRunner
{}
}
}
// TODO: Refactor out kubectl.Path global
if
kubectlPath
!=
""
{
kubectl
.
Path
=
kubectlPath
}
return
&
kubectl
.
RealRunner
{}
return
&
kubectl
.
RealRunner
{}
}
}
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