Skip to content

Commit 1da711d

Browse files
committed
updated sealed secret app to new style
Signed-off-by: Nitishkumar Singh <[email protected]>
1 parent 3e0f125 commit 1da711d

File tree

1 file changed

+25
-26
lines changed

1 file changed

+25
-26
lines changed

cmd/apps/sealed_secret_app.go

+25-26
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import (
99
"os"
1010
"path"
1111

12+
"github.com/alexellis/arkade/pkg/apps"
1213
"github.com/alexellis/arkade/pkg/k8s"
14+
"github.com/alexellis/arkade/pkg/types"
1315

1416
"github.com/alexellis/arkade/pkg"
1517
"github.com/alexellis/arkade/pkg/config"
@@ -34,14 +36,6 @@ func MakeInstallSealedSecrets() *cobra.Command {
3436
command.RunE = func(command *cobra.Command, args []string) error {
3537

3638
wait, _ := command.Flags().GetBool("wait")
37-
kubeConfigPath := config.GetDefaultKubeconfig()
38-
39-
if command.Flags().Changed("kubeconfig") {
40-
kubeConfigPath, _ = command.Flags().GetString("kubeconfig")
41-
}
42-
43-
fmt.Printf("Using kubeconfig: %s\n", kubeConfigPath)
44-
4539
namespace, _ := command.Flags().GetString("namespace")
4640

4741
arch := k8s.GetNodeArchitecture()
@@ -64,22 +58,7 @@ func MakeInstallSealedSecrets() *cobra.Command {
6458

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

67-
_, err = helm.TryDownloadHelm(userPath, clientArch, clientOS)
68-
if err != nil {
69-
return err
70-
}
71-
7261
updateRepo, _ := command.Flags().GetBool("update-repo")
73-
err = helm.AddHelmRepo("stable", "https://kubernetes-charts.storage.googleapis.com/", updateRepo)
74-
if err != nil {
75-
return fmt.Errorf("unable to add repo %s", err)
76-
}
77-
78-
err = helm.FetchChart("stable/sealed-secrets", defaultVersion)
79-
80-
if err != nil {
81-
return fmt.Errorf("unable fetch chart %s", err)
82-
}
8362

8463
overrides := map[string]string{}
8564

@@ -92,11 +71,31 @@ func MakeInstallSealedSecrets() *cobra.Command {
9271
return err
9372
}
9473

95-
err = helm.Helm3Upgrade("stable/sealed-secrets",
96-
namespace, "values.yaml", defaultVersion, overrides, wait)
74+
sealedSecretAppOptions := types.DefaultInstallOptions().
75+
WithNamespace(namespace).
76+
WithHelmPath(path.Join(userPath, ".helm")).
77+
WithHelmRepo("stable/sealed-secrets").
78+
WithHelmURL("https://charts.helm.sh/stable").
79+
WithOverrides(overrides).
80+
WithHelmUpdateRepo(updateRepo).
81+
WithWait(wait)
82+
83+
if command.Flags().Changed("kubeconfig") {
84+
kubeConfigPath, _ := command.Flags().GetString("kubeconfig")
85+
fmt.Printf("Using kubeconfig: %s\n", kubeConfigPath)
86+
sealedSecretAppOptions.WithKubeconfigPath(kubeConfigPath)
87+
}
88+
89+
_, err = helm.TryDownloadHelm(userPath, clientArch, clientOS)
9790
if err != nil {
98-
return fmt.Errorf("unable to sealed secret chart with helm %s", err)
91+
return err
92+
}
93+
94+
_, err = apps.MakeInstallChart(sealedSecretAppOptions)
95+
if err != nil {
96+
return err
9997
}
98+
10099
fmt.Println(SealedSecretsPostInstallMsg)
101100
return nil
102101
}

0 commit comments

Comments
 (0)