@@ -136,6 +136,10 @@ func (b *StorageInitJobBuilder) buildInitJobVolumes() []corev1.Volume {
136136 },
137137 }
138138
139+ if b .Spec .Service .Interconnect .TLSConfiguration .Enabled {
140+ volumes = append (volumes , buildTLSVolume (interconnectTLSVolumeName , b .Spec .Service .Interconnect .TLSConfiguration ))
141+ }
142+
139143 if b .Spec .Service .GRPC .TLSConfiguration .Enabled {
140144 volumes = append (volumes , buildTLSVolume (GRPCTLSVolumeName , b .Spec .Service .GRPC .TLSConfiguration ))
141145 }
@@ -222,16 +226,7 @@ func (b *StorageInitJobBuilder) buildInitJobContainer() corev1.Container { // to
222226 return container
223227}
224228
225- func (b * StorageInitJobBuilder ) buildJobVolumeMounts () []corev1.VolumeMount {
226- volumeMounts := []corev1.VolumeMount {
227- {
228- Name : configVolumeName ,
229- ReadOnly : true ,
230- MountPath : fmt .Sprintf ("%s/%s" , api .ConfigDir , api .ConfigFileName ),
231- SubPath : api .ConfigFileName ,
232- },
233- }
234-
229+ func (b * StorageInitJobBuilder ) appendTLSVolumeMounts (volumeMounts []corev1.VolumeMount ) []corev1.VolumeMount {
235230 if b .Spec .Service .GRPC .TLSConfiguration .Enabled {
236231 volumeMounts = append (volumeMounts , corev1.VolumeMount {
237232 Name : GRPCTLSVolumeName ,
@@ -240,12 +235,11 @@ func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
240235 })
241236 }
242237
243- if b .Spec .OperatorConnection != nil {
244- secretName := fmt .Sprintf (OperatorTokenSecretNameFormat , b .Storage .Name )
238+ if b .Spec .Service .Interconnect .TLSConfiguration .Enabled {
245239 volumeMounts = append (volumeMounts , corev1.VolumeMount {
246- Name : operatorTokenVolumeName ,
240+ Name : interconnectTLSVolumeName ,
247241 ReadOnly : true ,
248- MountPath : fmt . Sprintf ( "%s/%s" , wellKnownDirForAdditionalSecrets , secretName ) ,
242+ MountPath : interconnectTLSVolumeMountPath ,
249243 })
250244 }
251245
@@ -260,6 +254,29 @@ func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
260254 MountPath : systemCertsDir ,
261255 })
262256 }
257+ return volumeMounts
258+ }
259+
260+ func (b * StorageInitJobBuilder ) buildJobVolumeMounts () []corev1.VolumeMount {
261+ volumeMounts := []corev1.VolumeMount {
262+ {
263+ Name : configVolumeName ,
264+ ReadOnly : true ,
265+ MountPath : fmt .Sprintf ("%s/%s" , api .ConfigDir , api .ConfigFileName ),
266+ SubPath : api .ConfigFileName ,
267+ },
268+ }
269+
270+ if b .Spec .OperatorConnection != nil {
271+ secretName := fmt .Sprintf (OperatorTokenSecretNameFormat , b .Storage .Name )
272+ volumeMounts = append (volumeMounts , corev1.VolumeMount {
273+ Name : operatorTokenVolumeName ,
274+ ReadOnly : true ,
275+ MountPath : fmt .Sprintf ("%s/%s" , wellKnownDirForAdditionalSecrets , secretName ),
276+ })
277+ }
278+
279+ volumeMounts = b .appendTLSVolumeMounts (volumeMounts )
263280
264281 return volumeMounts
265282}
@@ -301,29 +318,7 @@ func (b *StorageInitJobBuilder) buildCaStorePatchingInitContainer() corev1.Conta
301318}
302319
303320func (b * StorageInitJobBuilder ) buildCaStorePatchingInitContainerVolumeMounts () []corev1.VolumeMount {
304- volumeMounts := []corev1.VolumeMount {}
305-
306- if b .AnyCertificatesAdded () {
307- volumeMounts = append (volumeMounts , corev1.VolumeMount {
308- Name : localCertsVolumeName ,
309- MountPath : localCertsDir ,
310- })
311-
312- volumeMounts = append (volumeMounts , corev1.VolumeMount {
313- Name : systemCertsVolumeName ,
314- MountPath : systemCertsDir ,
315- })
316- }
317-
318- if b .Spec .Service .GRPC .TLSConfiguration .Enabled {
319- volumeMounts = append (volumeMounts , corev1.VolumeMount {
320- Name : GRPCTLSVolumeName ,
321- ReadOnly : true ,
322- MountPath : grpcTLSVolumeMountPath ,
323- })
324- }
325-
326- return volumeMounts
321+ return b .appendTLSVolumeMounts ([]corev1.VolumeMount {})
327322}
328323
329324func (b * StorageInitJobBuilder ) buildBlobStorageInitCommandArgs () ([]string , []string ) {
0 commit comments