@@ -247,6 +247,177 @@ var _ = Describe("Glanceapi controller", func() {
247247 }, timeout , interval ).Should (Succeed ())
248248 })
249249 })
250+ Context ("GlanceAPI is deployed with S3 backend and TLS is enabled" , func () {
251+ keystoneAPIName := types.NamespacedName {}
252+
253+ BeforeEach (func () {
254+ DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
255+ infra .SimulateMemcachedReady (glanceTest .GlanceMemcached )
256+ DeferCleanup (th .DeleteInstance , CreateDefaultGlance (glanceTest .Instance ))
257+ DeferCleanup (
258+ mariadb .DeleteDBService ,
259+ mariadb .CreateDBService (
260+ glanceName .Namespace ,
261+ GetGlance (glanceTest .Instance ).Spec .DatabaseInstance ,
262+ corev1.ServiceSpec {
263+ Ports : []corev1.ServicePort {{Port : 3306 }},
264+ },
265+ ),
266+ )
267+
268+ mariadb .CreateMariaDBDatabase (glanceTest .GlanceDatabaseName .Namespace , glanceTest .GlanceDatabaseName .Name , mariadbv1.MariaDBDatabaseSpec {})
269+ DeferCleanup (k8sClient .Delete , ctx , mariadb .GetMariaDBDatabase (glanceTest .GlanceDatabaseName ))
270+
271+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCABundleSecret (glanceTest .CABundleSecret ))
272+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (glanceTest .InternalCertSecret ))
273+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (glanceTest .PublicCertSecret ))
274+ spec := GetTLSGlanceAPISpec (GlanceAPITypeInternal )
275+ spec ["customServiceConfig" ] = GlanceS3Backend
276+ DeferCleanup (th .DeleteInstance , CreateGlanceAPI (glanceTest .GlanceInternal , spec ))
277+
278+ keystoneAPIName = keystone .CreateKeystoneAPI (glanceTest .GlanceInternal .Namespace )
279+ DeferCleanup (keystone .DeleteKeystoneAPI , keystoneAPIName )
280+ keystone .CreateKeystoneEndpoint (glanceTest .GlanceInternal )
281+ keystone .SimulateKeystoneEndpointReady (glanceTest .GlanceInternal )
282+ th .SimulateStatefulSetReplicaReady (glanceTest .GlanceInternalStatefulSet )
283+
284+ th .ExpectCondition (
285+ glanceTest .GlanceInternal ,
286+ ConditionGetterFunc (GlanceAPIConditionGetter ),
287+ condition .ReadyCondition ,
288+ corev1 .ConditionTrue ,
289+ )
290+ })
291+
292+ It ("s3 backend is present in customServiceConfig" , func () {
293+ gapi := GetGlanceAPI (glanceTest .GlanceInternal )
294+ Expect (gapi .Spec .CustomServiceConfig ).Should (ContainSubstring ("s3" ))
295+ })
296+
297+ It ("extends customServiceConfig and inject s3_store_cacert" , func () {
298+ Eventually (func (g Gomega ) {
299+ confSecret := th .GetSecret (glanceTest .GlanceInternalConfigMapData )
300+ g .Expect (confSecret ).ShouldNot (BeNil ())
301+ g .Expect (confSecret .Data ).Should (HaveKey ("02-config.conf" ))
302+ conf := string (confSecret .Data ["02-config.conf" ])
303+ g .Expect (string (conf )).Should (
304+ ContainSubstring ("s3_store_cacert" ))
305+ }, timeout , interval ).Should (Succeed ())
306+ })
307+ })
308+ Context ("GlanceAPI is deployed with S3 backend and a customServiceConfig override and TLS is enabled" , func () {
309+ keystoneAPIName := types.NamespacedName {}
310+
311+ BeforeEach (func () {
312+ DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
313+ infra .SimulateMemcachedReady (glanceTest .GlanceMemcached )
314+ DeferCleanup (th .DeleteInstance , CreateDefaultGlance (glanceTest .Instance ))
315+ DeferCleanup (
316+ mariadb .DeleteDBService ,
317+ mariadb .CreateDBService (
318+ glanceName .Namespace ,
319+ GetGlance (glanceTest .Instance ).Spec .DatabaseInstance ,
320+ corev1.ServiceSpec {
321+ Ports : []corev1.ServicePort {{Port : 3306 }},
322+ },
323+ ),
324+ )
325+
326+ mariadb .CreateMariaDBDatabase (glanceTest .GlanceDatabaseName .Namespace , glanceTest .GlanceDatabaseName .Name , mariadbv1.MariaDBDatabaseSpec {})
327+ DeferCleanup (k8sClient .Delete , ctx , mariadb .GetMariaDBDatabase (glanceTest .GlanceDatabaseName ))
328+
329+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCABundleSecret (glanceTest .CABundleSecret ))
330+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (glanceTest .InternalCertSecret ))
331+ DeferCleanup (k8sClient .Delete , ctx , th .CreateCertSecret (glanceTest .PublicCertSecret ))
332+ spec := GetTLSGlanceAPISpec (GlanceAPITypeInternal )
333+ spec ["customServiceConfig" ] = GlanceS3BackendOverride
334+ DeferCleanup (th .DeleteInstance , CreateGlanceAPI (glanceTest .GlanceInternal , spec ))
335+
336+ keystoneAPIName = keystone .CreateKeystoneAPI (glanceTest .GlanceInternal .Namespace )
337+ DeferCleanup (keystone .DeleteKeystoneAPI , keystoneAPIName )
338+ keystone .CreateKeystoneEndpoint (glanceTest .GlanceInternal )
339+ keystone .SimulateKeystoneEndpointReady (glanceTest .GlanceInternal )
340+ th .SimulateStatefulSetReplicaReady (glanceTest .GlanceInternalStatefulSet )
341+
342+ th .ExpectCondition (
343+ glanceTest .GlanceInternal ,
344+ ConditionGetterFunc (GlanceAPIConditionGetter ),
345+ condition .ReadyCondition ,
346+ corev1 .ConditionTrue ,
347+ )
348+ })
349+
350+ It ("s3 backend is present in customServiceConfig" , func () {
351+ gapi := GetGlanceAPI (glanceTest .GlanceInternal )
352+ Expect (gapi .Spec .CustomServiceConfig ).Should (ContainSubstring ("s3" ))
353+ })
354+
355+ It ("does not extend customServiceConfig because the key s3_store_cacert is already present" , func () {
356+ Eventually (func (g Gomega ) {
357+ confSecret := th .GetSecret (glanceTest .GlanceInternalConfigMapData )
358+ g .Expect (confSecret ).ShouldNot (BeNil ())
359+ g .Expect (confSecret .Data ).Should (HaveKey ("02-config.conf" ))
360+ conf := string (confSecret .Data ["02-config.conf" ])
361+ g .Expect (string (conf )).Should (
362+ ContainSubstring ("s3_store_cacert = \" \" " ))
363+ }, timeout , interval ).Should (Succeed ())
364+ })
365+ })
366+ Context ("GlanceAPI is deployed with S3 backend and TLS is disabled" , func () {
367+ keystoneAPIName := types.NamespacedName {}
368+
369+ BeforeEach (func () {
370+ DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
371+ infra .SimulateMemcachedReady (glanceTest .GlanceMemcached )
372+ DeferCleanup (th .DeleteInstance , CreateDefaultGlance (glanceTest .Instance ))
373+ DeferCleanup (
374+ mariadb .DeleteDBService ,
375+ mariadb .CreateDBService (
376+ glanceName .Namespace ,
377+ GetGlance (glanceTest .Instance ).Spec .DatabaseInstance ,
378+ corev1.ServiceSpec {
379+ Ports : []corev1.ServicePort {{Port : 3306 }},
380+ },
381+ ),
382+ )
383+
384+ mariadb .CreateMariaDBDatabase (glanceTest .GlanceDatabaseName .Namespace , glanceTest .GlanceDatabaseName .Name , mariadbv1.MariaDBDatabaseSpec {})
385+ DeferCleanup (k8sClient .Delete , ctx , mariadb .GetMariaDBDatabase (glanceTest .GlanceDatabaseName ))
386+
387+ spec := CreateGlanceAPISpec (GlanceAPITypeInternal )
388+ spec ["customServiceConfig" ] = GlanceS3Backend
389+ DeferCleanup (th .DeleteInstance , CreateGlanceAPI (glanceTest .GlanceInternal , spec ))
390+
391+ keystoneAPIName = keystone .CreateKeystoneAPI (glanceTest .GlanceInternal .Namespace )
392+ DeferCleanup (keystone .DeleteKeystoneAPI , keystoneAPIName )
393+ keystone .CreateKeystoneEndpoint (glanceTest .GlanceInternal )
394+ keystone .SimulateKeystoneEndpointReady (glanceTest .GlanceInternal )
395+ th .SimulateStatefulSetReplicaReady (glanceTest .GlanceInternalStatefulSet )
396+
397+ th .ExpectCondition (
398+ glanceTest .GlanceInternal ,
399+ ConditionGetterFunc (GlanceAPIConditionGetter ),
400+ condition .ReadyCondition ,
401+ corev1 .ConditionTrue ,
402+ )
403+ })
404+
405+ It ("s3 backend is present in customServiceConfig" , func () {
406+ gapi := GetGlanceAPI (glanceTest .GlanceInternal )
407+ Expect (gapi .Spec .CustomServiceConfig ).Should (ContainSubstring ("s3" ))
408+ })
409+
410+ It ("does not inject s3_store_cacert param" , func () {
411+ Eventually (func (g Gomega ) {
412+ confSecret := th .GetSecret (glanceTest .GlanceInternalConfigMapData )
413+ g .Expect (confSecret ).ShouldNot (BeNil ())
414+ g .Expect (confSecret .Data ).Should (HaveKey ("02-config.conf" ))
415+ conf := string (confSecret .Data ["02-config.conf" ])
416+ g .Expect (string (conf )).Should (Not (
417+ ContainSubstring ("s3_store_cacert" )))
418+ }, timeout , interval ).Should (Succeed ())
419+ })
420+ })
250421 When ("GlanceAPI is deployed with Cinder backend" , func () {
251422 BeforeEach (func () {
252423 DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
@@ -771,7 +942,6 @@ var _ = Describe("Glanceapi controller", func() {
771942 )
772943 })
773944 })
774-
775945 When ("A split GlanceAPI with TLS is generated by the top-level CR" , func () {
776946 BeforeEach (func () {
777947 DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
@@ -892,7 +1062,6 @@ var _ = Describe("Glanceapi controller", func() {
8921062 )
8931063 })
8941064 })
895-
8961065 When ("A single GlanceAPI with TLS is generated by the top-level CR (single-api)" , func () {
8971066 BeforeEach (func () {
8981067 DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
@@ -1092,7 +1261,6 @@ var _ = Describe("Glanceapi controller", func() {
10921261 }, timeout , interval ).Should (Succeed ())
10931262 })
10941263 })
1095-
10961264 When ("A GlanceAPI with TLS is created with service override endpointURL" , func () {
10971265 BeforeEach (func () {
10981266 DeferCleanup (infra .DeleteMemcached , infra .CreateMemcached (namespace , glanceTest .MemcachedInstance , memcachedSpec ))
@@ -1151,7 +1319,6 @@ var _ = Describe("Glanceapi controller", func() {
11511319 )
11521320 })
11531321 })
1154-
11551322 When ("GlanceAPI instance overrides a topology" , func () {
11561323 var topologyRefAlt * topologyv1.TopoRef
11571324 BeforeEach (func () {
@@ -1231,7 +1398,6 @@ var _ = Describe("Glanceapi controller", func() {
12311398 }, timeout , interval ).Should (Succeed ())
12321399 })
12331400 })
1234-
12351401 Context ("GlanceAPI is fully deployed" , func () {
12361402 keystoneAPIName := types.NamespacedName {}
12371403
0 commit comments