Heat: Support uWSGI for API server

Currently Heat 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: I5c5ac8ca3111cf1149c3fb083ea56e3ed2ce460c
This commit is contained in:
ricolin 2023-11-02 16:36:51 +08:00
parent 83a1a1e9b4
commit f6ce5ad406
8 changed files with 66 additions and 7 deletions

View File

@ -14,7 +14,7 @@ apiVersion: v1
appVersion: v1.0.0 appVersion: v1.0.0
description: OpenStack-Helm Heat description: OpenStack-Helm Heat
name: heat name: heat
version: 0.3.8 version: 0.3.9
home: https://docs.openstack.org/heat/latest/ home: https://docs.openstack.org/heat/latest/
icon: https://www.openstack.org/themes/openstack/images/project-mascots/Heat/OpenStack_Project_Heat_vertical.png icon: https://www.openstack.org/themes/openstack/images/project-mascots/Heat/OpenStack_Project_Heat_vertical.png
sources: sources:

View File

@ -49,8 +49,7 @@ function start () {
# Starts Apache2 # Starts Apache2
exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }} exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
{{- else }} {{- else }}
exec heat-api \ exec uwsgi --ini /etc/heat/heat-api-uwsgi.ini
--config-file /etc/heat/heat.conf
{{- end }} {{- end }}
} }

View File

@ -50,8 +50,7 @@ function start () {
# Starts Apache2 # Starts Apache2
exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }} exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
{{- else }} {{- else }}
exec heat-api-cfn \ exec uwsgi --ini /etc/heat/heat-api-cfn-uwsgi.ini
--config-file /etc/heat/heat.conf
{{- end }} {{- end }}
} }

View File

@ -123,6 +123,24 @@ limitations under the License.
{{- $_ := tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.heat.heat_api_cfn "bind_port" -}} {{- $_ := tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.heat.heat_api_cfn "bind_port" -}}
{{- end -}} {{- end -}}
{{- if empty .Values.conf.heat_api_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.heat_api_uwsgi.uwsgi "processes" .Values.conf.heat.heat_api.workers -}}
{{- end -}}
{{- if empty (index .Values.conf.heat_api_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "orchestration" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.heat_api_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
{{- if empty .Values.conf.heat_api_cfn_uwsgi.uwsgi.processes -}}
{{- $_ := set .Values.conf.heat_api_cfn_uwsgi.uwsgi "processes" .Values.conf.heat.heat_api_cfn.workers -}}
{{- end -}}
{{- if empty (index .Values.conf.heat_api_cfn_uwsgi.uwsgi "http-socket") -}}
{{- $http_socket_port := tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
{{- $_ := set .Values.conf.heat_api_cfn_uwsgi.uwsgi "http-socket" $http_socket -}}
{{- end -}}
{{- if and (empty .Values.conf.logging.handler_fluent) (has "fluent" .Values.conf.logging.handlers.keys) -}} {{- 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_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" }} {{- $fluentd_port := tuple "fluentd" "internal" "service" $envAll | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
@ -144,6 +162,8 @@ type: Opaque
data: data:
rally_tests.yaml: {{ toYaml .Values.conf.rally_tests.tests | b64enc }} rally_tests.yaml: {{ toYaml .Values.conf.rally_tests.tests | b64enc }}
heat.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.heat | b64enc }} heat.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.heat | b64enc }}
heat-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.heat_api_uwsgi | b64enc }}
heat-api-cfn-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.heat_api_cfn_uwsgi | 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 }}
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 }}

View File

@ -89,7 +89,7 @@ spec:
scheme: {{ tuple "orchestration" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} scheme: {{ tuple "orchestration" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
path: / path: /
port: {{ tuple "orchestration" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} port: {{ tuple "orchestration" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 30 initialDelaySeconds: 10
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -105,6 +105,10 @@ spec:
mountPath: /etc/heat/heat.conf mountPath: /etc/heat/heat.conf
subPath: heat.conf subPath: heat.conf
readOnly: true readOnly: true
- name: heat-etc
mountPath: /etc/heat/heat-api-uwsgi.ini
subPath: heat-api-uwsgi.ini
readOnly: true
{{ if .Values.conf.heat.DEFAULT.log_config_append }} {{ if .Values.conf.heat.DEFAULT.log_config_append }}
- name: heat-etc - name: heat-etc
mountPath: {{ .Values.conf.heat.DEFAULT.log_config_append }} mountPath: {{ .Values.conf.heat.DEFAULT.log_config_append }}

View File

@ -89,7 +89,7 @@ spec:
scheme: {{ tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }} scheme: {{ tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.keystone_endpoint_scheme_lookup" | upper }}
path: / path: /
port: {{ tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }} port: {{ tuple "cloudformation" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
initialDelaySeconds: 30 initialDelaySeconds: 10
volumeMounts: volumeMounts:
- name: pod-tmp - name: pod-tmp
mountPath: /tmp mountPath: /tmp
@ -101,6 +101,10 @@ spec:
mountPath: /tmp/heat-cfn.sh mountPath: /tmp/heat-cfn.sh
subPath: heat-cfn.sh subPath: heat-cfn.sh
readOnly: true readOnly: true
- name: heat-etc
mountPath: /etc/heat/heat-api-cfn-uwsgi.ini
subPath: heat-api-cfn-uwsgi.ini
readOnly: true
- name: heat-etc - name: heat-etc
mountPath: /etc/heat/heat.conf mountPath: /etc/heat/heat.conf
subPath: heat.conf subPath: heat.conf

View File

@ -490,6 +490,38 @@ conf:
priority: 0 priority: 0
apply-to: all apply-to: all
pattern: '^(?!(amq\.|reply_)).*' pattern: '^(?!(amq\.|reply_)).*'
heat_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: "heat-api:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/heat-wsgi-api
heat_api_cfn_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: "heat-api-cfn:"
route-user-agent: '^kube-probe.* donotlog:'
thunder-lock: true
worker-reload-mercy: 80
wsgi-file: /var/lib/openstack/bin/heat-wsgi-api-cfn
network: network:
api: api:

View File

@ -34,4 +34,5 @@ heat:
- 0.3.6 Add Ubuntu Jammy overrides - 0.3.6 Add Ubuntu Jammy overrides
- 0.3.7 Add 2023.2 Ubuntu Jammy overrides - 0.3.7 Add 2023.2 Ubuntu Jammy overrides
- 0.3.8 Fixed annotation indentation for jobs - 0.3.8 Fixed annotation indentation for jobs
- 0.3.9 Uses uWSGI for API services
... ...