Skip to content

Commit 505b811

Browse files
committed
wip
1 parent 72d0817 commit 505b811

File tree

2 files changed

+77
-2
lines changed

2 files changed

+77
-2
lines changed

internal/resources/storage_init_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ func (b *StorageInitJobBuilder) buildInitJobPodTemplateSpec() corev1.PodTemplate
7575
DNSConfig: &corev1.PodDNSConfig{
7676
Searches: dnsConfigSearches,
7777
},
78+
InitContainers: b.Spec.InitContainers,
7879
},
7980
}
8081

@@ -92,8 +93,7 @@ func (b *StorageInitJobBuilder) buildInitJobPodTemplateSpec() corev1.PodTemplate
9293
}
9394
}
9495

95-
// InitContainer only needed for CaBundle manipulation for now,
96-
// may be probably used for other stuff later
96+
// append an init container for updating the ca.crt if we have any certificates
9797
if b.AnyCertificatesAdded() {
9898
podTemplate.Spec.InitContainers = append(
9999
[]corev1.Container{b.buildCaStorePatchingInitContainer()},

tests/e2e/smoke_test.go

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -766,6 +766,81 @@ var _ = Describe("Operator smoke test", func() {
766766
By("execute simple query with ydb-go-sdk...")
767767
databasePath := DatabasePathWithDefaultDomain(databaseSample)
768768
ExecuteSimpleTableE2ETestWithSDK(databaseSample.Name, testobjects.YdbNamespace, databasePath)
769+
770+
It("Check init job has additional volumes", func() {
771+
By("create storage tls secret...")
772+
storageCert := testobjects.StorageCertificate()
773+
Expect(k8sClient.Create(ctx, storageCert)).Should(Succeed())
774+
775+
By("create storage...")
776+
storage := testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-config.yaml"))
777+
778+
secretName := testobjects.StorageCertificateSecretName
779+
secretPath := fmt.Sprintf("%s/%s", resources.wellKnownDirForAdditionalSecrets, secretName)
780+
781+
storage.Spec.Secrets = []*corev1.LocalObjectReference{
782+
{
783+
Name: secretName,
784+
},
785+
}
786+
787+
storage.Spec.InitContainers = []corev1.Container{
788+
{
789+
Name: "init-container",
790+
Image: storage.Spec.Image.Name,
791+
Command: []string{"bash", "-xc"},
792+
Args: []string{fmt.Sprintf("ls -la %s", secretPath)},
793+
VolumeMounts: []corev1.VolumeMount{
794+
{
795+
Name: secretName,
796+
MountPath: secretPath,
797+
ReadOnly: true,
798+
},
799+
},
800+
},
801+
}
802+
803+
Expect(k8sClient.Create(ctx, storage)).Should(Succeed())
804+
defer DeleteStorageSafely(ctx, k8sClient, storage)
805+
806+
By("waiting until Storage is ready ...")
807+
WaitUntilStorageReady(ctx, k8sClient, storage.Name, testobjects.YdbNamespace)
808+
})
809+
810+
It("Check init job has additional volumes with GRPCS enabled", func() {
811+
By("create storage tls secret...")
812+
storageCert := testobjects.StorageCertificate()
813+
Expect(k8sClient.Create(ctx, storageCert)).Should(Succeed())
814+
815+
By("create storage...")
816+
storage := testobjects.DefaultStorage(filepath.Join("..", "data", "storage-mirror-3-dc-config-tls.yaml"))
817+
818+
secretName := testobjects.StorageCertificateSecretName
819+
secretPath := fmt.Sprintf("%s/%s", resources.wellKnownDirForAdditionalSecrets, secretName)
820+
821+
storage.Spec.Service.GRPC.TLSConfiguration = testobjects.TLSConfiguration(secretName)
822+
823+
storage.Spec.InitContainers = []corev1.Container{
824+
{
825+
Name: "init-container",
826+
Image: storage.Spec.Image.Name,
827+
Command: []string{"bash", "-xc"},
828+
Args: []string{fmt.Sprintf("ls -la %s", secretPath)},
829+
VolumeMounts: []corev1.VolumeMount{
830+
{
831+
Name: resources.grpcTLSVolumeName,
832+
MountPath: secretPath,
833+
ReadOnly: true,
834+
},
835+
},
836+
},
837+
}
838+
839+
Expect(k8sClient.Create(ctx, storage)).Should(Succeed())
840+
defer DeleteStorageSafely(ctx, k8sClient, storage)
841+
842+
By("waiting until Storage is ready ...")
843+
WaitUntilStorageReady(ctx, k8sClient, storage.Name, testobjects.YdbNamespace)
769844
})
770845

771846
AfterEach(func() {

0 commit comments

Comments
 (0)