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
b1e0c8fc
Commit
b1e0c8fc
authored
May 24, 2016
by
Adam Reese
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #759 from adamreese/feat/tunnel2
feat(tunnel): wire in the tunnel setup and teardown
parents
d16e7881
f0a15743
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
66 additions
and
38 deletions
+66
-38
delete.go
cmd/helm/delete.go
+7
-6
get.go
cmd/helm/get.go
+5
-4
helm.go
cmd/helm/helm.go
+31
-14
install.go
cmd/helm/install.go
+5
-4
list.go
cmd/helm/list.go
+6
-5
status.go
cmd/helm/status.go
+5
-4
tunnel.go
cmd/helm/tunnel.go
+7
-1
No files found.
cmd/helm/delete.go
View file @
b1e0c8fc
...
@@ -18,12 +18,13 @@ deleting them.
...
@@ -18,12 +18,13 @@ deleting them.
var
deleteDryRun
bool
var
deleteDryRun
bool
var
deleteCommand
=
&
cobra
.
Command
{
var
deleteCommand
=
&
cobra
.
Command
{
Use
:
"delete [flags] RELEASE_NAME"
,
Use
:
"delete [flags] RELEASE_NAME"
,
Aliases
:
[]
string
{
"del"
},
Aliases
:
[]
string
{
"del"
},
SuggestFor
:
[]
string
{
"remove"
,
"rm"
},
SuggestFor
:
[]
string
{
"remove"
,
"rm"
},
Short
:
"Given a release name, delete the release from Kubernetes"
,
Short
:
"Given a release name, delete the release from Kubernetes"
,
Long
:
deleteDesc
,
Long
:
deleteDesc
,
RunE
:
delRelease
,
RunE
:
delRelease
,
PersistentPreRunE
:
setupConnection
,
}
}
func
init
()
{
func
init
()
{
...
...
cmd/helm/get.go
View file @
b1e0c8fc
...
@@ -46,10 +46,11 @@ var getOut = ""
...
@@ -46,10 +46,11 @@ var getOut = ""
var
errReleaseRequired
=
errors
.
New
(
"release name is required"
)
var
errReleaseRequired
=
errors
.
New
(
"release name is required"
)
var
getCommand
=
&
cobra
.
Command
{
var
getCommand
=
&
cobra
.
Command
{
Use
:
"get [flags] RELEASE_NAME"
,
Use
:
"get [flags] RELEASE_NAME"
,
Short
:
"Download a named release"
,
Short
:
"Download a named release"
,
Long
:
getHelp
,
Long
:
getHelp
,
RunE
:
getCmd
,
RunE
:
getCmd
,
PersistentPreRunE
:
setupConnection
,
}
}
var
getValuesCommand
=
&
cobra
.
Command
{
var
getValuesCommand
=
&
cobra
.
Command
{
...
...
cmd/helm/helm.go
View file @
b1e0c8fc
...
@@ -35,22 +35,22 @@ It will also set up any necessary local configuration.
...
@@ -35,22 +35,22 @@ It will also set up any necessary local configuration.
Common actions from this point include:
Common actions from this point include:
- helm search: search for charts
- helm search:
search for charts
- helm fetch: download a chart to your local directory to view
- helm fetch:
download a chart to your local directory to view
- helm install: upload the chart to Kubernetes
- helm install:
upload the chart to Kubernetes
- helm list: list releases of charts
- helm list:
list releases of charts
Environment:
Environment:
$HELM_HOME Set an alternative location for Helm files. By default, these are stored in ~/.helm
$HELM_HOME
Set an alternative location for Helm files. By default, these are stored in ~/.helm
$HELM_HOST Set an alternative Tiller host. The format is host:port (default ":44134").
$HELM_HOST
Set an alternative Tiller host. The format is host:port (default ":44134").
`
`
// RootCommand is the top-level command for Helm.
// RootCommand is the top-level command for Helm.
var
RootCommand
=
&
cobra
.
Command
{
var
RootCommand
=
&
cobra
.
Command
{
Use
:
"helm"
,
Use
:
"helm"
,
Short
:
"The Helm package manager for Kubernetes."
,
Short
:
"The Helm package manager for Kubernetes."
,
Long
:
globalUsage
,
Long
:
globalUsage
,
PersistentP
reRun
:
bootstrap
,
PersistentP
ostRun
:
teardown
,
}
}
func
init
()
{
func
init
()
{
...
@@ -59,9 +59,6 @@ func init() {
...
@@ -59,9 +59,6 @@ func init() {
home
=
"$HOME/.helm"
home
=
"$HOME/.helm"
}
}
thost
:=
os
.
Getenv
(
hostEnvVar
)
thost
:=
os
.
Getenv
(
hostEnvVar
)
if
thost
==
""
{
thost
=
defaultHost
}
p
:=
RootCommand
.
PersistentFlags
()
p
:=
RootCommand
.
PersistentFlags
()
p
.
StringVar
(
&
helmHome
,
"home"
,
home
,
"location of your Helm config. Overrides $HELM_HOME."
)
p
.
StringVar
(
&
helmHome
,
"home"
,
home
,
"location of your Helm config. Overrides $HELM_HOME."
)
p
.
StringVar
(
&
tillerHost
,
"host"
,
thost
,
"address of tiller. Overrides $HELM_HOST."
)
p
.
StringVar
(
&
tillerHost
,
"host"
,
thost
,
"address of tiller. Overrides $HELM_HOST."
)
...
@@ -74,12 +71,32 @@ func main() {
...
@@ -74,12 +71,32 @@ func main() {
}
}
}
}
func
bootstrap
(
c
*
cobra
.
Command
,
args
[]
string
)
{
func
setupConnection
(
c
*
cobra
.
Command
,
args
[]
string
)
error
{
if
tillerHost
==
""
{
// Should failure fall back to default host?
tunnel
,
err
:=
newTillerPortForwarder
()
if
err
!=
nil
{
return
err
}
tillerHost
=
fmt
.
Sprintf
(
":%d"
,
tunnel
.
Local
)
if
flagVerbose
{
fmt
.
Printf
(
"Created tunnel using local port: '%d'
\n
"
,
tunnel
.
Local
)
}
}
// Set up the gRPC config.
// Set up the gRPC config.
helm
.
Config
.
ServAddr
=
tillerHost
helm
.
Config
.
ServAddr
=
tillerHost
if
flagVerbose
{
if
flagVerbose
{
fmt
.
Printf
(
"Server: %q
\n
"
,
helm
.
Config
.
ServAddr
)
fmt
.
Printf
(
"Server: %q
\n
"
,
helm
.
Config
.
ServAddr
)
}
}
return
nil
}
func
teardown
(
c
*
cobra
.
Command
,
args
[]
string
)
{
if
tunnel
!=
nil
{
tunnel
.
Close
()
}
}
}
func
checkArgsLength
(
expectedNum
,
actualNum
int
,
requiredArgs
...
string
)
error
{
func
checkArgsLength
(
expectedNum
,
actualNum
int
,
requiredArgs
...
string
)
error
{
...
...
cmd/helm/install.go
View file @
b1e0c8fc
...
@@ -35,10 +35,11 @@ var (
...
@@ -35,10 +35,11 @@ var (
)
)
var
installCmd
=
&
cobra
.
Command
{
var
installCmd
=
&
cobra
.
Command
{
Use
:
"install [CHART]"
,
Use
:
"install [CHART]"
,
Short
:
"install a chart archive."
,
Short
:
"install a chart archive."
,
Long
:
installDesc
,
Long
:
installDesc
,
RunE
:
runInstall
,
RunE
:
runInstall
,
PersistentPreRunE
:
setupConnection
,
}
}
func
init
()
{
func
init
()
{
...
...
cmd/helm/list.go
View file @
b1e0c8fc
...
@@ -37,11 +37,12 @@ flag with the '--offset' flag allows you to page through results.
...
@@ -37,11 +37,12 @@ flag with the '--offset' flag allows you to page through results.
`
`
var
listCommand
=
&
cobra
.
Command
{
var
listCommand
=
&
cobra
.
Command
{
Use
:
"list [flags] [FILTER]"
,
Use
:
"list [flags] [FILTER]"
,
Short
:
"List releases"
,
Short
:
"List releases"
,
Long
:
listHelp
,
Long
:
listHelp
,
RunE
:
listCmd
,
RunE
:
listCmd
,
Aliases
:
[]
string
{
"ls"
},
Aliases
:
[]
string
{
"ls"
},
PersistentPreRunE
:
setupConnection
,
}
}
var
(
var
(
...
...
cmd/helm/status.go
View file @
b1e0c8fc
...
@@ -13,10 +13,11 @@ This command shows the status of a named release.
...
@@ -13,10 +13,11 @@ This command shows the status of a named release.
`
`
var
statusCommand
=
&
cobra
.
Command
{
var
statusCommand
=
&
cobra
.
Command
{
Use
:
"status [flags] RELEASE_NAME"
,
Use
:
"status [flags] RELEASE_NAME"
,
Short
:
"Displays the status of the named release"
,
Short
:
"Displays the status of the named release"
,
Long
:
statusHelp
,
Long
:
statusHelp
,
RunE
:
status
,
RunE
:
status
,
PersistentPreRunE
:
setupConnection
,
}
}
func
init
()
{
func
init
()
{
...
...
cmd/helm/tunnel.go
View file @
b1e0c8fc
...
@@ -9,12 +9,17 @@ import (
...
@@ -9,12 +9,17 @@ import (
"github.com/kubernetes/helm/pkg/kube"
"github.com/kubernetes/helm/pkg/kube"
)
)
// TODO refactor out this global var
var
tunnel
*
kube
.
Tunnel
func
newTillerPortForwarder
()
(
*
kube
.
Tunnel
,
error
)
{
func
newTillerPortForwarder
()
(
*
kube
.
Tunnel
,
error
)
{
podName
,
err
:=
getTillerPodName
(
"helm"
)
podName
,
err
:=
getTillerPodName
(
"helm"
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
return
kube
.
New
(
nil
)
.
ForwardPort
(
"helm"
,
podName
,
44134
)
// FIXME use a constain that is accessable on init
const
tillerPort
=
44134
return
kube
.
New
(
nil
)
.
ForwardPort
(
"helm"
,
podName
,
tillerPort
)
}
}
func
getTillerPodName
(
namespace
string
)
(
string
,
error
)
{
func
getTillerPodName
(
namespace
string
)
(
string
,
error
)
{
...
@@ -23,6 +28,7 @@ func getTillerPodName(namespace string) (string, error) {
...
@@ -23,6 +28,7 @@ func getTillerPodName(namespace string) (string, error) {
return
""
,
err
return
""
,
err
}
}
// TODO use a const for labels
selector
:=
labels
.
Set
{
"app"
:
"helm"
,
"name"
:
"tiller"
}
.
AsSelector
()
selector
:=
labels
.
Set
{
"app"
:
"helm"
,
"name"
:
"tiller"
}
.
AsSelector
()
options
:=
api
.
ListOptions
{
LabelSelector
:
selector
}
options
:=
api
.
ListOptions
{
LabelSelector
:
selector
}
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
pods
,
err
:=
client
.
Pods
(
namespace
)
.
List
(
options
)
...
...
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