Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Fixed-20250210-112112.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Fixed
body: fix passing interconnet TLS volume in blobstorage-init job
time: 2025-02-10T11:21:12.37515+01:00
69 changes: 32 additions & 37 deletions internal/resources/storage_init_job.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,10 @@ func (b *StorageInitJobBuilder) buildInitJobVolumes() []corev1.Volume {
},
}

if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
volumes = append(volumes, buildTLSVolume(interconnectTLSVolumeName, b.Spec.Service.Interconnect.TLSConfiguration))
}

if b.Spec.Service.GRPC.TLSConfiguration.Enabled {
volumes = append(volumes, buildTLSVolume(GRPCTLSVolumeName, b.Spec.Service.GRPC.TLSConfiguration))
}
Expand Down Expand Up @@ -222,16 +226,7 @@ func (b *StorageInitJobBuilder) buildInitJobContainer() corev1.Container { // to
return container
}

func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
volumeMounts := []corev1.VolumeMount{
{
Name: configVolumeName,
ReadOnly: true,
MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName),
SubPath: api.ConfigFileName,
},
}

func (b *StorageInitJobBuilder) appendTLSVolumeMounts(volumeMounts []corev1.VolumeMount) []corev1.VolumeMount {
if b.Spec.Service.GRPC.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: GRPCTLSVolumeName,
Expand All @@ -240,12 +235,11 @@ func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
})
}

if b.Spec.OperatorConnection != nil {
secretName := fmt.Sprintf(OperatorTokenSecretNameFormat, b.Storage.Name)
if b.Spec.Service.Interconnect.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: operatorTokenVolumeName,
Name: interconnectTLSVolumeName,
ReadOnly: true,
MountPath: fmt.Sprintf("%s/%s", wellKnownDirForAdditionalSecrets, secretName),
MountPath: interconnectTLSVolumeMountPath,
})
}

Expand All @@ -260,6 +254,29 @@ func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
MountPath: systemCertsDir,
})
}
return volumeMounts
}

func (b *StorageInitJobBuilder) buildJobVolumeMounts() []corev1.VolumeMount {
volumeMounts := []corev1.VolumeMount{
{
Name: configVolumeName,
ReadOnly: true,
MountPath: fmt.Sprintf("%s/%s", api.ConfigDir, api.ConfigFileName),
SubPath: api.ConfigFileName,
},
}

if b.Spec.OperatorConnection != nil {
secretName := fmt.Sprintf(OperatorTokenSecretNameFormat, b.Storage.Name)
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: operatorTokenVolumeName,
ReadOnly: true,
MountPath: fmt.Sprintf("%s/%s", wellKnownDirForAdditionalSecrets, secretName),
})
}

volumeMounts = b.appendTLSVolumeMounts(volumeMounts)

return volumeMounts
}
Expand Down Expand Up @@ -301,29 +318,7 @@ func (b *StorageInitJobBuilder) buildCaStorePatchingInitContainer() corev1.Conta
}

func (b *StorageInitJobBuilder) buildCaStorePatchingInitContainerVolumeMounts() []corev1.VolumeMount {
volumeMounts := []corev1.VolumeMount{}

if b.AnyCertificatesAdded() {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: localCertsVolumeName,
MountPath: localCertsDir,
})

volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: systemCertsVolumeName,
MountPath: systemCertsDir,
})
}

if b.Spec.Service.GRPC.TLSConfiguration.Enabled {
volumeMounts = append(volumeMounts, corev1.VolumeMount{
Name: GRPCTLSVolumeName,
ReadOnly: true,
MountPath: grpcTLSVolumeMountPath,
})
}

return volumeMounts
return b.appendTLSVolumeMounts([]corev1.VolumeMount{})
}

func (b *StorageInitJobBuilder) buildBlobStorageInitCommandArgs() ([]string, []string) {
Expand Down