chore(nova): use uwsgi (#596)

diff --git a/charts/nova/templates/bin/_nova-api-metadata.sh.tpl b/charts/nova/templates/bin/_nova-api-metadata.sh.tpl
index 18195f2..e7602e8 100644
--- a/charts/nova/templates/bin/_nova-api-metadata.sh.tpl
+++ b/charts/nova/templates/bin/_nova-api-metadata.sh.tpl
@@ -48,9 +48,7 @@
   # Starts Apache2
   exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
 {{- else }}
-  exec nova-api-metadata \
-        --config-file /etc/nova/nova.conf \
-        --config-file /tmp/pod-shared/nova-api-metadata.ini
+  exec uwsgi --ini /etc/nova/nova-metadata-uwsgi.ini
 {{- end }}
 }
 
diff --git a/charts/nova/templates/bin/_nova-api.sh.tpl b/charts/nova/templates/bin/_nova-api.sh.tpl
index c62de9a..1084386 100644
--- a/charts/nova/templates/bin/_nova-api.sh.tpl
+++ b/charts/nova/templates/bin/_nova-api.sh.tpl
@@ -49,8 +49,7 @@
   # Starts Apache2
   exec {{ .Values.conf.software.apache2.binary }} {{ .Values.conf.software.apache2.start_parameters }}
 {{- else }}
-  exec nova-api-os-compute \
-        --config-file /etc/nova/nova.conf
+  exec uwsgi --ini /etc/nova/nova-api-uwsgi.ini
 {{- end }}
 }
 
diff --git a/charts/nova/templates/configmap-etc.yaml b/charts/nova/templates/configmap-etc.yaml
index aa4958b..ec1b886 100644
--- a/charts/nova/templates/configmap-etc.yaml
+++ b/charts/nova/templates/configmap-etc.yaml
@@ -279,6 +279,24 @@
 {{- $_ := tuple "compute" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | set .Values.conf.nova.DEFAULT "osapi_compute_listen_port" -}}
 {{- end -}}
 
+{{- if empty .Values.conf.nova_api_uwsgi.uwsgi.processes -}}
+{{- $_ := set .Values.conf.nova_api_uwsgi.uwsgi "processes" .Values.conf.nova.DEFAULT.osapi_compute_workers -}}
+{{- end -}}
+{{- if empty (index .Values.conf.nova_api_uwsgi.uwsgi "http-socket") -}}
+{{- $http_socket_port := tuple "compute" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
+{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
+{{- $_ := set .Values.conf.nova_api_uwsgi.uwsgi "http-socket" $http_socket -}}
+{{- end -}}
+
+{{- if empty .Values.conf.nova_metadata_uwsgi.uwsgi.processes -}}
+{{- $_ := set .Values.conf.nova_metadata_uwsgi.uwsgi "processes" .Values.conf.nova.DEFAULT.metadata_workers -}}
+{{- end -}}
+{{- if empty (index .Values.conf.nova_metadata_uwsgi.uwsgi "http-socket") -}}
+{{- $http_socket_port := .Values.network.metadata.port | toString }}
+{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
+{{- $_ := set .Values.conf.nova_metadata_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" }}
@@ -318,6 +336,8 @@
   logging.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.logging | b64enc }}
   api_audit_map.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.api_audit_map | b64enc }}
   nova-ironic.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.nova_ironic | b64enc }}
+  nova-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.nova_api_uwsgi | b64enc }}
+  nova-metadata-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.nova_metadata_uwsgi | b64enc }}
 {{- if .Values.manifests.certificates }}
 {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.mpm_event "key" "mpm_event.conf" "format" "Secret" ) | indent 2 }}
 {{- include "helm-toolkit.snippets.values_template_renderer" (dict "envAll" $envAll "template" .Values.conf.wsgi_nova_api "key" "wsgi-api.conf" "format" "Secret" ) | indent 2 }}
diff --git a/charts/nova/templates/deployment-api-metadata.yaml b/charts/nova/templates/deployment-api-metadata.yaml
index e7039f5..2f0463e 100644
--- a/charts/nova/templates/deployment-api-metadata.yaml
+++ b/charts/nova/templates/deployment-api-metadata.yaml
@@ -120,6 +120,10 @@
               mountPath: /tmp/nova-api-metadata.sh
               subPath: nova-api-metadata.sh
               readOnly: true
+            - name: nova-etc
+              mountPath: /etc/nova/nova-metadata-uwsgi.ini
+              subPath: nova-metadata-uwsgi.ini
+              readOnly: true
             - name: nova-bin
               mountPath: /sbin/iptables
               subPath: fake-iptables.sh
diff --git a/charts/nova/templates/deployment-api-osapi.yaml b/charts/nova/templates/deployment-api-osapi.yaml
index 4cb6744..88bbf41 100644
--- a/charts/nova/templates/deployment-api-osapi.yaml
+++ b/charts/nova/templates/deployment-api-osapi.yaml
@@ -108,6 +108,10 @@
               mountPath: /etc/nova/nova.conf
               subPath: nova.conf
               readOnly: true
+            - name: nova-etc
+              mountPath: /etc/nova/nova-api-uwsgi.ini
+              subPath: nova-api-uwsgi.ini
+              readOnly: true
             {{- if .Values.conf.nova.DEFAULT.log_config_append }}
             - name: nova-etc
               mountPath: {{ .Values.conf.nova.DEFAULT.log_config_append }}
diff --git a/charts/nova/values.yaml b/charts/nova/values.yaml
index 5e0ad19..e15dbb5 100644
--- a/charts/nova/values.yaml
+++ b/charts/nova/values.yaml
@@ -1533,6 +1533,38 @@
     before:
       enabled: false
       date: 'nil'
+  nova_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: "nova-api:"
+      route-user-agent: '^kube-probe.* donotlog:'
+      thunder-lock: true
+      worker-reload-mercy: 80
+      wsgi-file: /var/lib/openstack/bin/nova-api-wsgi
+  nova_metadata_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: "nova-metadata:"
+      route-user-agent: '^kube-probe.* donotlog:'
+      thunder-lock: true
+      worker-reload-mercy: 80
+      wsgi-file: /var/lib/openstack/bin/nova-metadata-wsgi
 
 # Names of secrets used by bootstrap and environmental checks
 secrets:
@@ -1990,29 +2022,29 @@
         liveness:
           enabled: True
           params:
-            initialDelaySeconds: 30
-            periodSeconds: 60
-            timeoutSeconds: 15
+            initialDelaySeconds: 5
+            periodSeconds: 10
+            timeoutSeconds: 5
         readiness:
           enabled: True
           params:
-            initialDelaySeconds: 30
-            periodSeconds: 60
-            timeoutSeconds: 15
+            initialDelaySeconds: 5
+            periodSeconds: 10
+            timeoutSeconds: 5
     api-osapi:
       default:
         liveness:
           enabled: True
           params:
-            initialDelaySeconds: 30
-            periodSeconds: 60
-            timeoutSeconds: 15
+            initialDelaySeconds: 5
+            periodSeconds: 10
+            timeoutSeconds: 5
         readiness:
           enabled: True
           params:
-            initialDelaySeconds: 30
-            periodSeconds: 60
-            timeoutSeconds: 15
+            initialDelaySeconds: 5
+            periodSeconds: 10
+            timeoutSeconds: 5
     conductor:
       default:
         liveness:
diff --git a/roles/defaults/vars/main.yml b/roles/defaults/vars/main.yml
index e06b673..96b47ee 100644
--- a/roles/defaults/vars/main.yml
+++ b/roles/defaults/vars/main.yml
@@ -128,23 +128,23 @@
   neutron_sriov_agent_init: quay.io/vexxhost/neutron@sha256:06f8356d37a5421f3266fa31c5afaec520f31e819ceeb6e1f83fcc5101b8de92 # image-source: quay.io/vexxhost/neutron:zed
   neutron_sriov_agent: quay.io/vexxhost/neutron@sha256:06f8356d37a5421f3266fa31c5afaec520f31e819ceeb6e1f83fcc5101b8de92 # image-source: quay.io/vexxhost/neutron:zed
   node_feature_discovery: registry.k8s.io/nfd/node-feature-discovery:v0.11.2
-  nova_api: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_archive_deleted_rows: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
+  nova_api: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_archive_deleted_rows: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
   nova_cell_setup_init: quay.io/vexxhost/heat@sha256:755225f9a63c0968f1ceeda3a2f06c66dd8d247ff00308f549e66496aa8f59d0 # image-source: quay.io/vexxhost/heat:zed
-  nova_cell_setup: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
+  nova_cell_setup: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
   nova_compute_ironic: quay.io/openstack.kolla/nova-compute-ironic:zed-ubuntu-jammy
   nova_compute_ssh: quay.io/vexxhost/nova-ssh:latest
-  nova_compute: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_conductor: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_consoleauth: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_db_sync: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_novncproxy_assets: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_novncproxy: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_placement: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_scheduler: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
+  nova_compute: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_conductor: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_consoleauth: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_db_sync: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_novncproxy_assets: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_novncproxy: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_placement: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_scheduler: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
   nova_service_cleaner: quay.io/vexxhost/cli:latest
-  nova_spiceproxy_assets: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
-  nova_spiceproxy: quay.io/vexxhost/nova@sha256:bd4a877013053e134a33edc18546f99923a2057072328a4323683eb315acd308 # image-source: quay.io/vexxhost/nova:zed
+  nova_spiceproxy_assets: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
+  nova_spiceproxy: quay.io/vexxhost/nova@sha256:132aec4034dd7508443cd14c7c2b7859a20917b90e17d153a84e2d8f920b5f23 # image-source: quay.io/vexxhost/nova:zed
   octavia_api: quay.io/vexxhost/octavia@sha256:9065365ed1d731e5130dcf7d600bc8dc8ffa158093c53dd151eddfe49a29a5ee # image-source: quay.io/vexxhost/octavia:zed
   octavia_db_sync: quay.io/vexxhost/octavia@sha256:9065365ed1d731e5130dcf7d600bc8dc8ffa158093c53dd151eddfe49a29a5ee # image-source: quay.io/vexxhost/octavia:zed
   octavia_health_manager_init: quay.io/vexxhost/heat@sha256:755225f9a63c0968f1ceeda3a2f06c66dd8d247ff00308f549e66496aa8f59d0 # image-source: quay.io/vexxhost/heat:zed