Add uwsgi ini env vars
Change-Id: Ic99a2a6ad0281180598d5b23372e535bbb513f19
This commit is contained in:
parent
4070b122b6
commit
cc35c62c12
@ -33,9 +33,11 @@ def create_or_resume(name, spec, **_):
|
||||
start the service up for the first time.
|
||||
"""
|
||||
|
||||
env = utils.get_uwsgi_env()
|
||||
for component in ("api", "api-cfn"):
|
||||
utils.create_or_update('heat/deployment.yml.j2',
|
||||
name=name, spec=spec, component=component)
|
||||
name=name, spec=spec,
|
||||
component=component, env=env)
|
||||
utils.create_or_update('heat/service.yml.j2',
|
||||
name=name, component=component)
|
||||
|
||||
|
@ -51,8 +51,10 @@ def create_or_resume(namespace, name, spec, **_):
|
||||
config = utils.create_or_update('horizon/configmap.yml.j2',
|
||||
name=name, spec=spec, auth_url=auth_url)
|
||||
config_hash = utils.generate_hash(config.obj['data'])
|
||||
env = utils.get_uwsgi_env()
|
||||
utils.create_or_update('horizon/deployment.yml.j2',
|
||||
config_hash=config_hash, name=name, spec=spec)
|
||||
config_hash=config_hash, name=name,
|
||||
spec=spec, env=env)
|
||||
utils.create_or_update('horizon/service.yml.j2',
|
||||
name=name, spec=spec)
|
||||
utils.create_or_update('horizon/memcached.yml.j2',
|
||||
@ -74,8 +76,10 @@ def update(name, spec, **_):
|
||||
config = utils.create_or_update('horizon/configmap.yml.j2',
|
||||
name=name, spec=spec, auth_url=auth_url)
|
||||
config_hash = utils.generate_hash(config.obj['data'])
|
||||
env = utils.get_uwsgi_env()
|
||||
utils.create_or_update('horizon/deployment.yml.j2',
|
||||
config_hash=config_hash, name=name, spec=spec)
|
||||
config_hash=config_hash, name=name,
|
||||
spec=spec, env=env)
|
||||
if hasattr(spec, "ingress"):
|
||||
utils.create_or_update('horizon/ingress.yml.j2',
|
||||
name=name, spec=spec)
|
||||
|
@ -30,9 +30,9 @@ def create_or_resume(name, spec, **_):
|
||||
This function is called when a new resource is created but also when we
|
||||
start the service up for the first time.
|
||||
"""
|
||||
|
||||
env = utils.get_uwsgi_env()
|
||||
utils.create_or_update('keystone/deployment.yml.j2',
|
||||
name=name, spec=spec)
|
||||
name=name, spec=spec, env=env)
|
||||
utils.create_or_update('keystone/service.yml.j2',
|
||||
name=name, spec=spec)
|
||||
utils.create_or_update('keystone/horizontalpodautoscaler.yml.j2',
|
||||
|
@ -39,6 +39,13 @@ spec:
|
||||
- name: heat-{{ component }}
|
||||
image: vexxhost/heat-{{ component }}:latest
|
||||
imagePullPolicy: Always
|
||||
{% if env is defined %}
|
||||
env:
|
||||
{% for v in env %}
|
||||
- name: "{{ v.name }}"
|
||||
value: "{{ v.value }}"
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% if 'api' in component %}
|
||||
ports:
|
||||
- name: heat-{{ component }}
|
||||
|
@ -36,6 +36,10 @@ spec:
|
||||
image: vexxhost/horizon:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
{% for v in env %}
|
||||
- name: "{{ v.name }}"
|
||||
value: "{{ v.value }}"
|
||||
{% endfor %}
|
||||
- name: SECRET_KEY
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
|
@ -33,6 +33,11 @@ spec:
|
||||
- name: keystone
|
||||
image: vexxhost/keystone:latest
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
{% for v in env %}
|
||||
- name: "{{ v.name }}"
|
||||
value: "{{ v.value }}"
|
||||
{% endfor %}
|
||||
ports:
|
||||
- name: keystone
|
||||
containerPort: 5000
|
||||
|
@ -35,6 +35,24 @@ from openstack_operator import objects
|
||||
|
||||
|
||||
DIR_PATH = os.path.dirname(os.path.realpath(__file__))
|
||||
|
||||
UWSGI_SETTINGS = {
|
||||
'UWSGI_ENABLE_THREADS': True,
|
||||
'UWSGI_PROCESSES': 2,
|
||||
'UWSGI_EXIT_ON_RELOAD': True,
|
||||
'UWSGI_DIE_ON_TERM': True,
|
||||
'UWSGI_LAZY_APPS': True,
|
||||
'UWSGI_ADD_HEADER': 'Connection: close',
|
||||
'UWSGI_BUFFER_SIZE': 65535,
|
||||
'UWSGI_THUNDER_LOCK': True,
|
||||
'UWSGI_DISABLE_LOGGING': True,
|
||||
'UWSGI_AUTO_CHUNCKED': True,
|
||||
'UWSGI_HTTP_RAW_BODY': True,
|
||||
'UWSGI_SOCKET_TIMEOUT': 10,
|
||||
'UWSGI_NEED_APP': True,
|
||||
'UWSGI_ROUTE_USER_AGENT': '^kube-probe.* donotlog:'
|
||||
}
|
||||
|
||||
VERSION = version.VersionInfo('openstack_operator').version_string()
|
||||
|
||||
|
||||
@ -194,8 +212,16 @@ def get_secret(namespace, name):
|
||||
|
||||
|
||||
def generate_hash(dictionary):
|
||||
"""Generate a has from a dictionary, return None if dictionary is empty"""
|
||||
"""Generate a hash from a dictionary, return None if dictionary is empty"""
|
||||
|
||||
if not dictionary:
|
||||
return None
|
||||
return hash(frozenset(dictionary.items()))
|
||||
|
||||
|
||||
def get_uwsgi_env():
|
||||
"""Generate k8s env list from UWSGI_SETTINGS dict"""
|
||||
res = []
|
||||
for key, value in UWSGI_SETTINGS.items():
|
||||
res.append({'name': key, 'value': value})
|
||||
return res
|
||||
|
Loading…
x
Reference in New Issue
Block a user