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
306aca6a
Commit
306aca6a
authored
Apr 14, 2016
by
Michelle Noorali
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(init): add init logic
+ -i flag to override tiller image
parent
72acb82e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
init.go
cmd/helm/init.go
+29
-2
init_test.go
cmd/helm/init_test.go
+3
-7
No files found.
cmd/helm/init.go
View file @
306aca6a
...
...
@@ -4,10 +4,15 @@ import (
"errors"
"fmt"
"github.com/deis/tiller/pkg/client"
"github.com/deis/tiller/pkg/kubectl"
"github.com/spf13/cobra"
)
var
tillerImg
string
func
init
()
{
initCmd
.
Flags
()
.
StringVarP
(
&
tillerImg
,
"tiller-image"
,
"i"
,
""
,
"override tiller image"
)
RootCommand
.
AddCommand
(
initCmd
)
}
...
...
@@ -20,6 +25,28 @@ var initCmd = &cobra.Command{
// RunInit initializes local config and installs tiller to Kubernetes Cluster
func
RunInit
(
cmd
*
cobra
.
Command
,
args
[]
string
)
error
{
fmt
.
Fprintln
(
stdout
,
"Init was called."
)
return
errors
.
New
(
"NotImplemented"
)
if
len
(
args
)
!=
0
{
return
errors
.
New
(
"This command does not accept arguments.
\n
"
)
}
// TODO: take value of global flag kubectl and pass that in
runner
:=
buildKubectlRunner
(
""
)
i
:=
client
.
NewInstaller
()
i
.
Tiller
[
"Image"
]
=
tillerImg
out
,
err
:=
i
.
Install
(
runner
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error installing %s %s"
,
string
(
out
),
err
)
}
fmt
.
Printf
(
"Tiller (the helm server side component) has been installed into your Kubernetes Cluster.
\n
"
)
return
nil
}
func
buildKubectlRunner
(
kubectlPath
string
)
kubectl
.
Runner
{
if
kubectlPath
!=
""
{
kubectl
.
Path
=
kubectlPath
}
return
&
kubectl
.
RealRunner
{}
}
cmd/helm/init_test.go
View file @
306aca6a
...
...
@@ -4,11 +4,7 @@ import (
"testing"
)
func
TestRunInit
(
t
*
testing
.
T
)
{
//TODO: call command and make sure no error is recevied
err
:=
RunInit
(
initCmd
,
nil
)
if
err
!=
nil
{
t
.
Errorf
(
"Expected no error but got one: %s"
,
err
)
}
func
TestInit
(
t
*
testing
.
T
)
{
//TODO: call command and make sure no error is returned
//TODO: check local config
}
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