Skip to content

Commit

Permalink
Merge pull request #311 from olliewalsh/memcached_tls
Browse files Browse the repository at this point in the history
Set tls_context for django/pymemcache
  • Loading branch information
openshift-merge-bot[bot] authored Apr 3, 2024
2 parents 7477c1f + ec5bb0d commit b48a63e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions controllers/horizon_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -786,6 +786,7 @@ func (r *HorizonReconciler) generateServiceConfigMaps(
"keystoneURL": authURL,
"horizonEndpointUrl": url.Host,
"memcachedServers": mc.GetMemcachedServerListQuotedString(),
"memcachedTLS": mc.GetMemcachedTLSSupport(),
"ServerName": fmt.Sprintf("%s.%s.svc", horizon.ServiceName, instance.Namespace),
"Port": horizon.HorizonPort,
"TLS": false,
Expand Down
8 changes: 7 additions & 1 deletion templates/horizon/config/local_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# ----------------------------------------------------------------------

import os
import ssl

from django.utils.translation import gettext_lazy as _

Expand Down Expand Up @@ -111,7 +112,12 @@ def get_pod_ip():
'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache',
'LOCATION': [ {{.memcachedServers}} ],
# To drop the cached sessions when config changes
'KEY_PREFIX': os.environ['CONFIG_HASH']
'KEY_PREFIX': os.environ['CONFIG_HASH'],
'OPTIONS': {
{{- if .memcachedTLS }}
'tls_context': ssl.create_default_context()
{{- end }}
}
},
}

Expand Down

0 comments on commit b48a63e

Please sign in to comment.