Skip to content

Commit

Permalink
Merge pull request #450 from karelyatin/OSPRH-12223
Browse files Browse the repository at this point in the history
Fix default cache config for no tls
  • Loading branch information
openshift-merge-bot[bot] authored Dec 9, 2024
2 parents 7ad510e + d5a21af commit e48b3c9
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion templates/neutronapi/config/01-neutron.conf
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,12 @@ lock_path = /var/lib/neutron/tmp
[cache]
{{if .MemcachedTLS}}
backend = dogpile.cache.pymemcache
memcache_servers = {{ .MemcachedServers }}
{{else}}
backend = dogpile.cache.memcached
memcache_servers = {{ .MemcachedServersWithInet }}
{{end}}
enabled=true
memcache_servers={{ .MemcachedServers }}
tls_enabled={{ .MemcachedTLS }}

[oslo_policy]
Expand Down
22 changes: 15 additions & 7 deletions test/functional/neutronapi_controller_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -701,13 +701,21 @@ func getNeutronAPIControllerSuite(ml2MechanismDrivers []string) func() {
Eventually(func() corev1.Secret {
return th.GetSecret(secret)
}, timeout, interval).ShouldNot(BeNil())
memcacheInstance := infra.GetMemcached(memcachedName)
neutronCfg := string(th.GetSecret(secret).Data["01-neutron.conf"])
if memcacheInstance.GetMemcachedTLSSupport() {
Expect(neutronCfg).Should(
ContainSubstring("backend = dogpile.cache.pymemcache"))
Expect(neutronCfg).Should(
ContainSubstring(fmt.Sprintf("memcache_servers = %s", memcacheInstance.GetMemcachedServerListString())))
} else {
Expect(neutronCfg).Should(
ContainSubstring("backend = dogpile.cache.memcached"))
Expect(neutronCfg).Should(
ContainSubstring(fmt.Sprintf("memcache_servers = %s", memcacheInstance.GetMemcachedServerListWithInetString())))
}
Expect(neutronCfg).Should(
ContainSubstring(fmt.Sprintf("memcache_servers=memcached-0.memcached.%s.svc:11211,memcached-1.memcached.%s.svc:11211,memcached-2.memcached.%s.svc:11211",
neutronAPIName.Namespace, neutronAPIName.Namespace, neutronAPIName.Namespace)))
Expect(neutronCfg).Should(
ContainSubstring(fmt.Sprintf("memcached_servers=inet:[memcached-0.memcached.%s.svc]:11211,inet:[memcached-1.memcached.%s.svc]:11211,inet:[memcached-2.memcached.%s.svc]:11211",
neutronAPIName.Namespace, neutronAPIName.Namespace, neutronAPIName.Namespace)))
ContainSubstring(fmt.Sprintf("memcached_servers=%s", memcacheInstance.GetMemcachedServerListWithInetString())))
})

if isOVNEnabled {
Expand Down Expand Up @@ -1137,7 +1145,7 @@ func getNeutronAPIControllerSuite(ml2MechanismDrivers []string) func() {
)
SimulateTransportURLReady(apiTransportURLName)
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(namespace, "memcached", memcachedSpec))
infra.SimulateMemcachedReady(memcachedName)
infra.SimulateTLSMemcachedReady(memcachedName)
DeferCleanup(DeleteOVNDBClusters, CreateOVNDBClusters(namespace))
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(namespace))
mariadb.SimulateMariaDBAccountCompleted(types.NamespacedName{Namespace: namespace, Name: GetNeutronAPI(neutronAPIName).Spec.DatabaseAccount})
Expand Down Expand Up @@ -1325,7 +1333,7 @@ func getNeutronAPIControllerSuite(ml2MechanismDrivers []string) func() {
)
SimulateTransportURLReady(apiTransportURLName)
DeferCleanup(infra.DeleteMemcached, infra.CreateMemcached(namespace, "memcached", memcachedSpec))
infra.SimulateMemcachedReady(memcachedName)
infra.SimulateTLSMemcachedReady(memcachedName)
DeferCleanup(DeleteOVNDBClusters, CreateOVNDBClusters(namespace))
DeferCleanup(keystone.DeleteKeystoneAPI, keystone.CreateKeystoneAPI(namespace))
mariadb.SimulateMariaDBAccountCompleted(types.NamespacedName{Namespace: namespace, Name: GetNeutronAPI(neutronAPIName).Spec.DatabaseAccount})
Expand Down

0 comments on commit e48b3c9

Please sign in to comment.