Senlin: Support uWSGI for API server

Currently Senlin 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: I8ec0db12f6002fad8cfde0c873b70279af891994
This commit is contained in:
ricolin 2023-11-02 14:23:25 +08:00
parent f65cb36c84
commit b6e6dad141
6 changed files with 34 additions and 4 deletions

View File

@ -12,4 +12,5 @@ senlin:
- 0.2.7 Added OCI registry authentication
- 0.2.8 Remove default policy rules
- 0.2.9 Define service_type in keystone_authtoken to support application credentials with access rules
- 0.2.10 Uses uWSGI for API
...

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0
description: OpenStack-Helm Senlin
name: senlin
version: 0.2.9
version: 0.2.10
home: https://docs.openstack.org/senlin/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Senlin/OpenStack_Project_Senlin_vertical.png
sources:

View File

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

View File

@ -81,6 +81,15 @@ limitations under the License.
{{- $_ := set .Values.conf.senlin.authentication "service_username" .Values.endpoints.identity.auth.senlin.username -}}
{{- end -}}
{{- if empty .Values.conf.senlin_api_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.senlin_api_uwsgi.uwsgi "processes" .Values.conf.senlin.senlin_api.workers -}}
{{- end -}}
{{- if empty (index .Values.conf.senlin_api_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "clustering" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.senlin_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" }}
@ -102,6 +111,7 @@ type: Opaque
data:
rally_tests.yaml: {{ toYaml .Values.conf.rally_tests.tests | b64enc }}
senlin.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.senlin | b64enc }}
senlin-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.senlin_api_uwsgi | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }}
policy.yaml: {{ toYaml .Values.conf.policy | b64enc }}

View File

@ -75,7 +75,7 @@ spec:
scheme: HTTP
path: /
port: {{ tuple "clustering" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 15
initialDelaySeconds: 5
periodSeconds: 10
volumeMounts:
- name: pod-tmp
@ -88,6 +88,10 @@ spec:
mountPath: /etc/senlin
- name: pod-var-cache-senlin
mountPath: /var/cache/senlin
- name: senlin-etc
mountPath: /etc/senlin/senlin-api-uwsgi.ini
subPath: senlin-api-uwsgi.ini
readOnly: true
- name: senlin-etc
mountPath: /etc/senlin/senlin.conf
subPath: senlin.conf

View File

@ -204,6 +204,22 @@ conf:
formatter_default:
format: "%(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
senlin_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: "senlin-api:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/senlin-wsgi-api
network:
api: