Skip to content

Commit

Permalink
3206: import serviceAccountName as an envVar
Browse files Browse the repository at this point in the history
  • Loading branch information
russellcain committed Sep 19, 2024
1 parent a87f77d commit 04d29c3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
5 changes: 5 additions & 0 deletions pkg/controller/import-controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ type importPodEnvVar struct {
extraHeaders []string
secretExtraHeaders []string
cacheMode string
serviceAccountName string
}

type importerPodArgs struct {
Expand Down Expand Up @@ -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{
Expand Down
7 changes: 6 additions & 1 deletion pkg/controller/import-controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
})
})
Expand Down Expand Up @@ -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 != "" {
Expand Down

0 comments on commit 04d29c3

Please sign in to comment.