Skip to content

Commit

Permalink
add --set flag to postgres app
Browse files Browse the repository at this point in the history
Signed-off-by: Prateek Gogia <prateekgogia42@gmail.com>
  • Loading branch information
prateekgogia authored and alexellis committed Jan 13, 2020
1 parent a1470d1 commit 6eb0083
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cmd/postgres_app.go
Expand Up @@ -8,8 +8,8 @@ import (
"strconv" "strconv"
"strings" "strings"


"github.com/alexellis/k3sup/pkg/env"
"github.com/alexellis/k3sup/pkg/config" "github.com/alexellis/k3sup/pkg/config"
"github.com/alexellis/k3sup/pkg/env"
"github.com/spf13/cobra" "github.com/spf13/cobra"
) )


Expand All @@ -27,6 +27,9 @@ func makeInstallPostgresql() *cobra.Command {


postgresql.Flags().Bool("persistence", false, "Enable persistence") postgresql.Flags().Bool("persistence", false, "Enable persistence")


postgresql.Flags().StringArray("set", []string{},
"Use custom flags or override existing flags \n(example --set persistence.enabled=true)")

postgresql.RunE = func(command *cobra.Command, args []string) error { postgresql.RunE = func(command *cobra.Command, args []string) error {
kubeConfigPath := getDefaultKubeconfig() kubeConfigPath := getDefaultKubeconfig()


Expand Down Expand Up @@ -84,6 +87,15 @@ func makeInstallPostgresql() *cobra.Command {


overrides["persistence.enabled"] = strings.ToLower(strconv.FormatBool(persistence)) overrides["persistence.enabled"] = strings.ToLower(strconv.FormatBool(persistence))


customFlags, err := command.Flags().GetStringArray("set")
if err != nil {
return fmt.Errorf("error with --set usage: %s", err)
}

if err := mergeFlags(overrides, customFlags); err != nil {
return err
}

outputPath := path.Join(chartPath, "postgresql/rendered") outputPath := path.Join(chartPath, "postgresql/rendered")


err = templateChart(chartPath, err = templateChart(chartPath,
Expand Down

0 comments on commit 6eb0083

Please sign in to comment.