From 420927a0ea9c17faff085d1605080401013d8766 Mon Sep 17 00:00:00 2001 From: Adrian Stobbe Date: Mon, 31 Jul 2023 08:30:20 +0200 Subject: [PATCH] placeholderHelmInstaller --- cli/internal/cmd/init.go | 6 ++---- cli/internal/cmd/init_test.go | 12 +++++++++++- internal/deploy/helm/install.go | 1 - 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/cli/internal/cmd/init.go b/cli/internal/cmd/init.go index 7e6de811206..2f1386521bc 100644 --- a/cli/internal/cmd/init.go +++ b/cli/internal/cmd/init.go @@ -237,10 +237,8 @@ func (i *initCmd) initialize(cmd *cobra.Command, newDialer func(validator atls.V if err != nil { return err } - if i.helmInstaller != nil { - if err := i.helmInstaller.Install(cmd.Context(), provider, masterSecret, idFile, serviceAccURI, releases); err != nil { - return fmt.Errorf("installing Helm charts: %w", err) - } + if err := i.helmInstaller.Install(cmd.Context(), provider, masterSecret, idFile, serviceAccURI, releases); err != nil { + return fmt.Errorf("installing Helm charts: %w", err) } cmd.Println(bufferedOutput.String()) return nil diff --git a/cli/internal/cmd/init_test.go b/cli/internal/cmd/init_test.go index ab38692823c..63aba544436 100644 --- a/cli/internal/cmd/init_test.go +++ b/cli/internal/cmd/init_test.go @@ -28,6 +28,7 @@ import ( "github.com/edgelesssys/constellation/v2/internal/cloud/gcpshared" "github.com/edgelesssys/constellation/v2/internal/config" "github.com/edgelesssys/constellation/v2/internal/constants" + helminstaller "github.com/edgelesssys/constellation/v2/internal/deploy/helm" "github.com/edgelesssys/constellation/v2/internal/file" "github.com/edgelesssys/constellation/v2/internal/grpc/atlscredentials" "github.com/edgelesssys/constellation/v2/internal/grpc/dialer" @@ -174,7 +175,7 @@ func TestInitialize(t *testing.T) { ctx, cancel := context.WithTimeout(ctx, 4*time.Second) defer cancel() cmd.SetContext(ctx) - i := &initCmd{log: logger.NewTest(t), spinner: &nopSpinner{}} + i := &initCmd{log: logger.NewTest(t), spinner: &nopSpinner{}, helmInstaller: &placeholderHelmInstaller{}} err := i.initialize(cmd, newDialer, fileHandler, &stubLicenseClient{}, stubAttestationFetcher{}) if tc.wantErr { @@ -666,3 +667,12 @@ func (c stubInitClient) Recv() (*initproto.InitResponse, error) { return res, err } + +type placeholderHelmInstaller struct{} + +func (i *placeholderHelmInstaller) Install(_ context.Context, _ cloudprovider.Provider, _ uri.MasterSecret, + _ clusterid.File, + _ string, _ *helminstaller.Releases, +) error { + return nil +} diff --git a/internal/deploy/helm/install.go b/internal/deploy/helm/install.go index 27df30544ba..6e0558a264c 100644 --- a/internal/deploy/helm/install.go +++ b/internal/deploy/helm/install.go @@ -62,7 +62,6 @@ func NewInstaller(kubeconfig string, logger debugLog) (*Installer, error) { } // InstallChart is the generic install function for helm charts. -// When timeout is nil, the default timeout is used. func (h *Installer) InstallChart(ctx context.Context, release Release) error { return h.InstallChartWithValues(ctx, release, nil) }