Glance: Support uWSGI for API server

Currently Glance API server still using eventlet-based HTTP servers,
it is generally considered more performant and flexible to run them
using a generic HTTP server that supports WSGI.

Change-Id: I7caec5d17f33d35843b4537965bafbb9b73d62ea
This commit is contained in:
ricolin 2023-11-01 22:11:55 +08:00
parent 643d643b8d
commit a2fe5e1f0e
7 changed files with 41 additions and 10 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Glance
name: glance
version: 0.4.20
version: 0.4.21
home: https://docs.openstack.org/glance/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Glance/OpenStack_Project_Glance_vertical.png
sources:

View File

@ -18,8 +18,7 @@ set -ex
COMMAND="${@:-start}"
function start () {
exec glance-api \
--config-file /etc/glance/glance-api.conf
exec uwsgi --ini /etc/glance/glance-api-uwsgi.ini
}
function stop () {

View File

@ -100,6 +100,15 @@ limitations under the License.
{{- $_ := tuple "image" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.glance.DEFAULT "bind_port" -}}
{{- end -}}
{{- if empty .Values.conf.glance_api_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.glance_api_uwsgi.uwsgi "processes" .Values.conf.glance.DEFAULT.workers -}}
{{- end -}}
{{- if empty (index .Values.conf.glance_api_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "image" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.glance_api_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}}
{{- $fluentd_host := tuple "fluentd" "internal" $envAll | include "helm-toolkit.endpoints.hostname_namespaced_endpoint_lookup" }}
{{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
@ -141,6 +150,7 @@ type: Opaque
data:
rally_tests.yaml: {{ toYaml .Values.conf.rally_tests.tests | b64enc }}
glance-api.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.glance | b64enc }}
glance-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.glance_api_uwsgi | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
glance-api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }}
policy.yaml: {{ toYaml .Values.conf.policy | b64enc }}

View File

@ -214,6 +214,10 @@ spec:
mountPath: /etc/glance/glance-api.conf
subPath: glance-api.conf
readOnly: true
- name: glance-etc
mountPath: /etc/glance/glance-api-uwsgi.ini
subPath: glance-api-uwsgi.ini
readOnly: true
{{- if .Values.conf.glance.DEFAULT.log_config_append }}
- name: glance-etc
mountPath: {{ .Values.conf.glance.DEFAULT.log_config_append }}

View File

@ -389,6 +389,22 @@ conf:
priority: 0
apply-to: all
pattern: '^(?!(amq\.|reply_)).*'
glance_api_uwsgi:
uwsgi:
add-header: "Connection: close"
buffer-size: 65535
die-on-term: true
enable-threads: true
exit-on-reload: false
hook-master-start: unix_signal:15 gracefully_kill_them_all
lazy-apps: true
log-x-forwarded-for: true
master: true
procname-prefix-spaced: "glance-api:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/glance-wsgi-api
network:
api:
@ -883,14 +899,14 @@ pod:
readiness:
enabled: true
params:
periodSeconds: 15
timeoutSeconds: 10
periodSeconds: 10
timeoutSeconds: 5
liveness:
enabled: true
params:
initialDelaySeconds: 30
periodSeconds: 15
timeoutSeconds: 10
initialDelaySeconds: 5
periodSeconds: 10
timeoutSeconds: 5
resources:
enabled: false
api:

View File

@ -4,8 +4,6 @@ images:
nginx: docker.io/nginx:1.18.0
conf:
glance:
DEFAULT:
bind_host: 127.0.0.1
keystone_authtoken:
cafile: /etc/glance/certs/ca.crt
glance_store:
@ -16,6 +14,9 @@ conf:
ssl_ca_file: /etc/rabbitmq/certs/ca.crt
ssl_cert_file: /etc/rabbitmq/certs/tls.crt
ssl_key_file: /etc/rabbitmq/certs/tls.key
glance_api_uwsgi:
uwsgi:
http-socket: 127.0.0.1:9292
nginx: |
worker_processes 1;
daemon off;

View File

@ -54,4 +54,5 @@ glance:
- 0.4.18 Enable custom annotations for Openstack pods
- 0.4.19 Add 2024.1 overrides
- 0.4.20 Add readiness probe initial delay
- 0.4.21 Use uWSGI
...