From a99f45541b91993b56d2acf1bfbe97d7e13aa5e4 Mon Sep 17 00:00:00 2001 From: Mitali Paygude Date: Thu, 15 Feb 2024 12:21:24 -0800 Subject: [PATCH] Update secrets for snow --- pkg/providers/snow/snow.go | 3 ++- pkg/providers/snow/snow_test.go | 11 +++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/pkg/providers/snow/snow.go b/pkg/providers/snow/snow.go index f23cd80f800c..83ef275da202 100644 --- a/pkg/providers/snow/snow.go +++ b/pkg/providers/snow/snow.go @@ -156,8 +156,9 @@ func (p *SnowProvider) GenerateCAPISpecForUpgrade(ctx context.Context, bootstrap return p.generateCAPISpec(ctx, bootstrapCluster, clusterSpec) } +// PreCAPIInstallOnBootstrap runs the steps that are provider specific before CAPI is installed on the bootstrap cluster. func (p *SnowProvider) PreCAPIInstallOnBootstrap(ctx context.Context, cluster *types.Cluster, clusterSpec *cluster.Spec) error { - return nil + return p.UpdateSecrets(ctx, cluster, clusterSpec) } func (p *SnowProvider) PostBootstrapSetup(ctx context.Context, clusterConfig *v1alpha1.Cluster, cluster *types.Cluster) error { diff --git a/pkg/providers/snow/snow_test.go b/pkg/providers/snow/snow_test.go index a0b4fb6d8c32..ca5898a20946 100644 --- a/pkg/providers/snow/snow_test.go +++ b/pkg/providers/snow/snow_test.go @@ -1352,6 +1352,17 @@ func TestUpdateSecrets(t *testing.T) { tt.Expect(tt.provider.UpdateSecrets(tt.ctx, tt.cluster, tt.clusterSpec)).To(Succeed()) } +func TestPreCAPIInstall(t *testing.T) { + tt := newSnowTest(t) + tt.kubeUnAuthClient.EXPECT().Apply( + tt.ctx, + tt.cluster.KubeconfigFile, + tt.clusterSpec.SnowCredentialsSecret, + ).Return(nil) + + tt.Expect(tt.provider.PreCAPIInstallOnBootstrap(tt.ctx, tt.cluster, tt.clusterSpec)).To(Succeed()) +} + func TestUpdateSecretsApplyError(t *testing.T) { tt := newSnowTest(t) tt.kubeUnAuthClient.EXPECT().Apply(