Designate: Support uWSGI for API server

Currently Designate 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: I8036ed5259c67ad1315815efa00eff80075b2ed2
This commit is contained in:
ricolin 2023-11-02 16:46:52 +08:00 committed by Vladimir Kozhukalov
parent f6ce5ad406
commit ddd851d40e
6 changed files with 33 additions and 3 deletions

View File

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

View File

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

View File

@ -65,6 +65,15 @@
{{- if empty (index .Values.conf.designate "service:api").api_base_uri -}} {{- if empty (index .Values.conf.designate "service:api").api_base_uri -}}
{{- $_ := tuple "dns" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set (index .Values.conf.designate "service:api") "api_base_uri" -}} {{- $_ := tuple "dns" "internal" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_uri_lookup" | set (index .Values.conf.designate "service:api") "api_base_uri" -}}
{{- end -}} {{- end -}}
{{- if empty .Values.conf.designate_api_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.designate_api_uwsgi.uwsgi "processes" (index .Values.conf.designate "service:api").workers -}}
{{- end -}}
{{- if empty (index .Values.conf.designate_api_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "dns" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.designate_api_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
--- ---
apiVersion: v1 apiVersion: v1
kind: Secret kind: Secret
@ -73,6 +82,7 @@ metadata:
type: Opaque type: Opaque
data: data:
designate.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.designate | b64enc }} designate.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.designate | b64enc }}
designate-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.designate_api_uwsgi | b64enc }}
api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }} api-paste.ini: {{ include "helm-toolkit.utils.to_ini" .Values.conf.paste | b64enc }}
policy.yaml: {{ toYaml .Values.conf.policy | b64enc }} policy.yaml: {{ toYaml .Values.conf.policy | b64enc }}
logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }} logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}

View File

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

View File

@ -528,6 +528,22 @@ conf:
formatter_default: formatter_default:
format: "%(message)s" format: "%(message)s"
datefmt: "%Y-%m-%d %H:%M:%S" datefmt: "%Y-%m-%d %H:%M:%S"
designate_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: "designate-api:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/designate-api-wsgi
# Names of secrets used by bootstrap and environmental checks # Names of secrets used by bootstrap and environmental checks
secrets: secrets:

View File

@ -13,4 +13,5 @@ designate:
- 0.2.7 Use HTTP probe instead of TCP probe - 0.2.7 Use HTTP probe instead of TCP probe
- 0.2.8 Remove default policy rules - 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.9 Define service_type in keystone_authtoken to support application credentials with access rules
- 0.2.10 Uses uWSGI for API service
... ...