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
3f2aa7a3
Commit
3f2aa7a3
authored
May 17, 2016
by
Matt Butcher
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #714 from technosophos/fix/skip-namespace
fix(helm): allow user to skip namespace creation
parents
df4dc3e1
e9440287
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
15 deletions
+30
-15
init.go
cmd/helm/init.go
+8
-5
install.go
pkg/client/install.go
+22
-10
No files found.
cmd/helm/init.go
View file @
3f2aa7a3
...
...
@@ -16,14 +16,17 @@ Kubernetes Cluster and sets up local configuration in $HELM_HOME (default: ~/.he
var
(
tillerImg
string
clientOnly
bool
tillerNamespace
string
clientOnly
bool
initSkipNamespace
bool
)
func
init
()
{
initCmd
.
Flags
()
.
StringVarP
(
&
tillerImg
,
"tiller-image"
,
"i"
,
""
,
"override tiller image"
)
initCmd
.
Flags
()
.
BoolVarP
(
&
clientOnly
,
"client-only"
,
"c"
,
false
,
"If set does not install tiller"
)
initCmd
.
Flags
()
.
StringVarP
(
&
tillerNamespace
,
"namespace"
,
"n"
,
"helm"
,
"set the tiller namespace"
)
f
:=
initCmd
.
Flags
()
f
.
StringVarP
(
&
tillerImg
,
"tiller-image"
,
"i"
,
""
,
"override tiller image"
)
f
.
BoolVarP
(
&
clientOnly
,
"client-only"
,
"c"
,
false
,
"If set does not install tiller"
)
f
.
BoolVarP
(
&
initSkipNamespace
,
"skip-namespace"
,
"s"
,
false
,
"Do not attempt to create a namespace. Assume the namespace is already there."
)
f
.
StringVarP
(
&
tillerNamespace
,
"namespace"
,
"n"
,
"helm"
,
"set the tiller namespace"
)
RootCommand
.
AddCommand
(
initCmd
)
}
...
...
@@ -60,7 +63,7 @@ func installTiller() error {
i
:=
client
.
NewInstaller
()
i
.
Tiller
[
"Image"
]
=
tillerImg
i
.
Tiller
[
"Namespace"
]
=
tillerNamespace
err
:=
i
.
Install
(
flagVerbose
)
err
:=
i
.
Install
(
flagVerbose
,
!
initSkipNamespace
)
if
err
!=
nil
{
return
fmt
.
Errorf
(
"error installing: %s"
,
err
)
...
...
pkg/client/install.go
View file @
3f2aa7a3
...
...
@@ -33,14 +33,24 @@ func NewInstaller() *Installer {
//
// Returns the string output received from the operation, and an error if the
// command failed.
func
(
i
*
Installer
)
Install
(
verbose
bool
)
error
{
//
// If verbose is true, this will print the manifest to stdout.
//
// If createNS is true, this will also create the namespace.
func
(
i
*
Installer
)
Install
(
verbose
,
createNS
bool
)
error
{
var
b
bytes
.
Buffer
err
:=
template
.
Must
(
template
.
New
(
"manifest"
)
.
Funcs
(
sprig
.
TxtFuncMap
())
.
Parse
(
InstallYAML
))
.
Execute
(
&
b
,
i
)
t
:=
template
.
New
(
"manifest"
)
.
Funcs
(
sprig
.
TxtFuncMap
())
if
err
!=
nil
{
// Add namespace
if
createNS
{
if
err
:=
template
.
Must
(
t
.
Parse
(
NamespaceYAML
))
.
Execute
(
&
b
,
i
);
err
!=
nil
{
return
err
}
}
// Add main install YAML
if
err
:=
template
.
Must
(
t
.
Parse
(
InstallYAML
))
.
Execute
(
&
b
,
i
);
err
!=
nil
{
return
err
}
...
...
@@ -48,11 +58,10 @@ func (i *Installer) Install(verbose bool) error {
fmt
.
Println
(
b
.
String
())
}
return
kube
.
New
(
nil
)
.
Create
(
"helm"
,
&
b
)
return
kube
.
New
(
nil
)
.
Create
(
i
.
Tiller
[
"Namespace"
]
.
(
string
)
,
&
b
)
}
// InstallYAML is the installation YAML for DM.
const
InstallYAML
=
`
const
NamespaceYAML
=
`
---{{$namespace := default "helm" .Tiller.Namespace}}
apiVersion: v1
kind: Namespace
...
...
@@ -61,7 +70,11 @@ metadata:
app: helm
name: helm-namespace
name: {{$namespace}}
---
`
// InstallYAML is the installation YAML for DM.
const
InstallYAML
=
`
---{{$namespace := default "helm" .Tiller.Namespace}}
apiVersion: v1
kind: ReplicationController
metadata:
...
...
@@ -93,5 +106,4 @@ spec:
- containerPort: 44134
name: tiller
imagePullPolicy: Always
---
`
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