Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated sealed secret app to new style #257

Merged
merged 1 commit into from
Nov 19, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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