|
|
@ -2,6 +2,7 @@ package main
|
|
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"io/ioutil"
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
"github.com/spf13/cobra"
|
|
|
|
|
|
|
|
|
|
|
@ -24,6 +25,8 @@ var (
|
|
|
|
installArg string
|
|
|
|
installArg string
|
|
|
|
// installDryRun performs a dry-run install
|
|
|
|
// installDryRun performs a dry-run install
|
|
|
|
installDryRun bool
|
|
|
|
installDryRun bool
|
|
|
|
|
|
|
|
// installValues is the filename of supplied values.
|
|
|
|
|
|
|
|
installValues string
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
var installCmd = &cobra.Command{
|
|
|
|
var installCmd = &cobra.Command{
|
|
|
@ -33,13 +36,27 @@ var installCmd = &cobra.Command{
|
|
|
|
RunE: runInstall,
|
|
|
|
RunE: runInstall,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
f := installCmd.Flags()
|
|
|
|
|
|
|
|
f.StringVar(&tillerHost, "host", "", "address of tiller server (default \":44134\")")
|
|
|
|
|
|
|
|
f.StringVarP(&installValues, "values", "f", "", "path to a values TOML file")
|
|
|
|
|
|
|
|
f.BoolVar(&installDryRun, "dry-run", false, "simulate an install")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RootCommand.AddCommand(installCmd)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func runInstall(cmd *cobra.Command, args []string) error {
|
|
|
|
func runInstall(cmd *cobra.Command, args []string) error {
|
|
|
|
if err := checkArgsLength(1, len(args), "chart name"); err != nil {
|
|
|
|
if err := checkArgsLength(1, len(args), "chart name"); err != nil {
|
|
|
|
return err
|
|
|
|
return err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
installArg = args[0]
|
|
|
|
installArg = args[0]
|
|
|
|
|
|
|
|
|
|
|
|
res, err := helm.InstallRelease(installArg, installDryRun)
|
|
|
|
rawVals, err := vals()
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
return err
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
res, err := helm.InstallRelease(rawVals, installArg, installDryRun)
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
return prettyError(err)
|
|
|
|
return prettyError(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -49,6 +66,13 @@ func runInstall(cmd *cobra.Command, args []string) error {
|
|
|
|
return nil
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func vals() ([]byte, error) {
|
|
|
|
|
|
|
|
if installValues == "" {
|
|
|
|
|
|
|
|
return []byte{}, nil
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return ioutil.ReadFile(installValues)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func printRelease(rel *release.Release) {
|
|
|
|
func printRelease(rel *release.Release) {
|
|
|
|
if rel == nil {
|
|
|
|
if rel == nil {
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -62,9 +86,3 @@ func printRelease(rel *release.Release) {
|
|
|
|
fmt.Println(rel.Name)
|
|
|
|
fmt.Println(rel.Name)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func init() {
|
|
|
|
|
|
|
|
installCmd.Flags().BoolVar(&installDryRun, "dry-run", false, "simulate an install")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RootCommand.AddCommand(installCmd)
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|