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
1a7373e5
Commit
1a7373e5
authored
Oct 13, 2016
by
Adam Reese
Committed by
GitHub
Oct 13, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1363 from adamreese/feat/helm-init-canary
feat(helm): add canary option to init command
parents
ab6a73a0
4f430079
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
5 deletions
+27
-5
init.go
cmd/helm/init.go
+4
-2
install.go
cmd/helm/installer/install.go
+5
-2
install_test.go
cmd/helm/installer/install_test.go
+18
-1
No files found.
cmd/helm/init.go
View file @
1a7373e5
...
...
@@ -46,6 +46,7 @@ const (
type
initCmd
struct
{
image
string
clientOnly
bool
canary
bool
out
io
.
Writer
home
helmpath
.
Home
kubeClient
unversioned
.
DeploymentsNamespacer
...
...
@@ -68,7 +69,8 @@ func newInitCmd(out io.Writer) *cobra.Command {
},
}
cmd
.
Flags
()
.
StringVarP
(
&
i
.
image
,
"tiller-image"
,
"i"
,
""
,
"override tiller image"
)
cmd
.
Flags
()
.
BoolVarP
(
&
i
.
clientOnly
,
"client-only"
,
"c"
,
false
,
"If set does not install tiller"
)
cmd
.
Flags
()
.
BoolVar
(
&
i
.
canary
,
"canary-image"
,
false
,
"use the canary tiller image"
)
cmd
.
Flags
()
.
BoolVarP
(
&
i
.
clientOnly
,
"client-only"
,
"c"
,
false
,
"if set does not install tiller"
)
return
cmd
}
...
...
@@ -86,7 +88,7 @@ func (i *initCmd) run() error {
}
i
.
kubeClient
=
c
}
if
err
:=
installer
.
Install
(
i
.
kubeClient
,
tillerNamespace
,
i
.
image
,
flagDebug
);
err
!=
nil
{
if
err
:=
installer
.
Install
(
i
.
kubeClient
,
tillerNamespace
,
i
.
image
,
i
.
canary
,
flagDebug
);
err
!=
nil
{
if
!
kerrors
.
IsAlreadyExists
(
err
)
{
return
fmt
.
Errorf
(
"error installing: %s"
,
err
)
}
...
...
cmd/helm/installer/install.go
View file @
1a7373e5
...
...
@@ -35,8 +35,11 @@ const defaultImage = "gcr.io/kubernetes-helm/tiller"
// command failed.
//
// If verbose is true, this will print the manifest to stdout.
func
Install
(
client
unversioned
.
DeploymentsNamespacer
,
namespace
,
image
string
,
verbose
bool
)
error
{
if
image
==
""
{
func
Install
(
client
unversioned
.
DeploymentsNamespacer
,
namespace
,
image
string
,
canary
,
verbose
bool
)
error
{
switch
{
case
canary
:
image
=
defaultImage
+
":canary"
case
image
==
""
:
image
=
fmt
.
Sprintf
(
"%s:%s"
,
defaultImage
,
version
.
Version
)
}
obj
:=
generateDeployment
(
image
)
...
...
cmd/helm/installer/install_test.go
View file @
1a7373e5
...
...
@@ -42,7 +42,24 @@ func TestInstall(t *testing.T) {
return
true
,
obj
,
nil
})
err
:=
Install
(
fake
.
Extensions
(),
"default"
,
image
,
false
)
err
:=
Install
(
fake
.
Extensions
(),
"default"
,
image
,
false
,
false
)
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
}
func
TestInstall_canary
(
t
*
testing
.
T
)
{
fake
:=
testclient
.
Fake
{}
fake
.
AddReactor
(
"create"
,
"deployments"
,
func
(
action
testclient
.
Action
)
(
bool
,
runtime
.
Object
,
error
)
{
obj
:=
action
.
(
testclient
.
CreateAction
)
.
GetObject
()
.
(
*
extensions
.
Deployment
)
i
:=
obj
.
Spec
.
Template
.
Spec
.
Containers
[
0
]
.
Image
if
i
!=
"gcr.io/kubernetes-helm/tiller:canary"
{
t
.
Errorf
(
"expected canary image, got '%s'"
,
i
)
}
return
true
,
obj
,
nil
})
err
:=
Install
(
fake
.
Extensions
(),
"default"
,
""
,
true
,
false
)
if
err
!=
nil
{
t
.
Errorf
(
"unexpected error: %#+v"
,
err
)
}
...
...
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