|
|
|
@ -50,7 +50,7 @@ var RootCommand = &cobra.Command{
|
|
|
|
|
Use: "helm",
|
|
|
|
|
Short: "The Helm package manager for Kubernetes.",
|
|
|
|
|
Long: globalUsage,
|
|
|
|
|
PersistentPreRun: bootstrap,
|
|
|
|
|
PersistentPostRun: teardown,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
@ -59,9 +59,6 @@ func init() {
|
|
|
|
|
home = "$HOME/.helm"
|
|
|
|
|
}
|
|
|
|
|
thost := os.Getenv(hostEnvVar)
|
|
|
|
|
if thost == "" {
|
|
|
|
|
thost = defaultHost
|
|
|
|
|
}
|
|
|
|
|
p := RootCommand.PersistentFlags()
|
|
|
|
|
p.StringVar(&helmHome, "home", home, "location of your Helm config. Overrides $HELM_HOME.")
|
|
|
|
|
p.StringVar(&tillerHost, "host", thost, "address of tiller. Overrides $HELM_HOST.")
|
|
|
|
@ -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.
|
|
|
|
|
helm.Config.ServAddr = tillerHost
|
|
|
|
|
if flagVerbose {
|
|
|
|
|
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 {
|
|
|
|
|