Skip to content

Commit

Permalink
updated sealed secret app to new style
Browse files Browse the repository at this point in the history
Signed-off-by: Nitishkumar Singh <[email protected]>

updated code based on #258

Signed-off-by: Nitishkumar Singh <[email protected]>

removed additional line

Signed-off-by: Nitishkumar Singh <[email protected]>

removed unwanted line

Signed-off-by: Nitishkumar Singh <[email protected]>

removed unwanted code

Signed-off-by: Nitishkumar Singh <[email protected]>

corrected repo path

Signed-off-by: Nitishkumar Singh <[email protected]>
  • Loading branch information
nitishkumar71 committed Nov 10, 2020
1 parent ba7cbad commit d8a0c68
Showing 1 changed file with 20 additions and 22 deletions.
42 changes: 20 additions & 22 deletions cmd/apps/sealed_secret_app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ import (
"os"
"path"

"github.com/alexellis/arkade/pkg/apps"
"github.com/alexellis/arkade/pkg/k8s"
"github.com/alexellis/arkade/pkg/types"

"github.com/alexellis/arkade/pkg"
"github.com/alexellis/arkade/pkg/config"
Expand All @@ -33,10 +35,6 @@ func MakeInstallSealedSecrets() *cobra.Command {

command.RunE = func(command *cobra.Command, args []string) error {
kubeConfigPath, _ := command.Flags().GetString("kubeconfig")
if err := config.SetKubeconfig(kubeConfigPath); err != nil {
return err
}
fmt.Printf("Using kubeconfig: %s\n", kubeConfigPath)

wait, _ := command.Flags().GetBool("wait")

Expand All @@ -62,22 +60,7 @@ func MakeInstallSealedSecrets() *cobra.Command {

os.Setenv("HELM_HOME", path.Join(userPath, ".helm"))

_, err = helm.TryDownloadHelm(userPath, clientArch, clientOS)
if err != nil {
return err
}

updateRepo, _ := command.Flags().GetBool("update-repo")
err = helm.AddHelmRepo("stable", "https://kubernetes-charts.storage.googleapis.com/", updateRepo)
if err != nil {
return fmt.Errorf("unable to add repo %s", err)
}

err = helm.FetchChart("stable/sealed-secrets", defaultVersion)

if err != nil {
return fmt.Errorf("unable fetch chart %s", err)
}

overrides := map[string]string{}

Expand All @@ -90,11 +73,26 @@ func MakeInstallSealedSecrets() *cobra.Command {
return err
}

err = helm.Helm3Upgrade("stable/sealed-secrets",
namespace, "values.yaml", defaultVersion, overrides, wait)
sealedSecretAppOptions := types.DefaultInstallOptions().
WithNamespace(namespace).
WithHelmPath(path.Join(userPath, ".helm")).
WithHelmRepo("stable/sealed-secrets").
WithHelmURL("https://kubernetes-charts.storage.googleapis.com").
WithOverrides(overrides).
WithHelmUpdateRepo(updateRepo).
WithWait(wait).
WithKubeconfigPath(kubeConfigPath)

_, err = helm.TryDownloadHelm(userPath, clientArch, clientOS)
if err != nil {
return err
}

_, err = apps.MakeInstallChart(sealedSecretAppOptions)
if err != nil {
return fmt.Errorf("unable to sealed secret chart with helm %s", err)
return err
}

fmt.Println(SealedSecretsPostInstallMsg)
return nil
}
Expand Down

0 comments on commit d8a0c68

Please sign in to comment.