From 4b97bf61b3dca2117bcfbc35b33f93a1d53cd32a Mon Sep 17 00:00:00 2001 From: russellcain Date: Thu, 19 Sep 2024 16:08:10 -0500 Subject: [PATCH] 3206: import serviceAccountName as an envVar Signed-off-by: russellcain --- pkg/controller/import-controller.go | 5 +++++ pkg/controller/import-controller_test.go | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/pkg/controller/import-controller.go b/pkg/controller/import-controller.go index 49f1ff898f..be71dc6804 100644 --- a/pkg/controller/import-controller.go +++ b/pkg/controller/import-controller.go @@ -102,6 +102,7 @@ type importPodEnvVar struct { extraHeaders []string secretExtraHeaders []string cacheMode string + serviceAccountName string } type importerPodArgs struct { @@ -1263,6 +1264,10 @@ func makeImportEnv(podEnvVar *importPodEnvVar, uid types.UID) []corev1.EnvVar { Name: common.CacheMode, Value: podEnvVar.cacheMode, }, + { + Name: common.ImporterServiceAccountName, + Value: podEnvVar.serviceAccountName, + }, } if podEnvVar.secretName != "" && podEnvVar.source != cc.SourceGCS { env = append(env, corev1.EnvVar{ diff --git a/pkg/controller/import-controller_test.go b/pkg/controller/import-controller_test.go index 96fb5e14a7..edb510bb11 100644 --- a/pkg/controller/import-controller_test.go +++ b/pkg/controller/import-controller_test.go @@ -962,7 +962,8 @@ var _ = Describe("Import test env", func() { currentCheckpoint: "", previousCheckpoint: "", finalCheckpoint: "", - preallocation: false} + preallocation: false, + serviceAccountName: ""} Expect(reflect.DeepEqual(makeImportEnv(testEnvVar, mockUID), createImportTestEnv(testEnvVar, mockUID))).To(BeTrue()) }) }) @@ -1245,6 +1246,10 @@ func createImportTestEnv(podEnvVar *importPodEnvVar, uid string) []corev1.EnvVar Name: common.CacheMode, Value: podEnvVar.cacheMode, }, + { + Name: common.ImporterServiceAccountName, + Value: podEnvVar.serviceAccountName, + }, } if podEnvVar.secretName != "" {