chore(magnum): use uwsgi (#607)
diff --git a/charts/magnum/templates/bin/_magnum-api.sh.tpl b/charts/magnum/templates/bin/_magnum-api.sh.tpl
index 5786cea..4f82862 100644
--- a/charts/magnum/templates/bin/_magnum-api.sh.tpl
+++ b/charts/magnum/templates/bin/_magnum-api.sh.tpl
@@ -18,8 +18,7 @@
COMMAND="${@:-start}"
function start () {
- exec magnum-api \
- --config-file /etc/magnum/magnum.conf
+ exec uwsgi --ini /etc/magnum/magnum-api-uwsgi.ini
}
function stop () {
diff --git a/charts/magnum/templates/configmap-etc.yaml b/charts/magnum/templates/configmap-etc.yaml
index 466e2ae..247b3f6 100644
--- a/charts/magnum/templates/configmap-etc.yaml
+++ b/charts/magnum/templates/configmap-etc.yaml
@@ -71,6 +71,15 @@
{{- $_ := set .Values.conf.magnum.trust "trustee_domain_admin_password" .Values.endpoints.identity.auth.magnum_stack_user.password -}}
{{- end -}}
+{{- if empty .Values.conf.magnum_api_uwsgi.uwsgi.processes -}}
+{{- $_ := set .Values.conf.magnum_api_uwsgi.uwsgi "processes" .Values.conf.magnum.api.workers -}}
+{{- end -}}
+{{- if empty (index .Values.conf.magnum_api_uwsgi.uwsgi "http-socket") -}}
+{{- $http_socket_port := tuple "container-infra" "service" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" | toString }}
+{{- $http_socket := printf "0.0.0.0:%s" $http_socket_port }}
+{{- $_ := set .Values.conf.magnum_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" }}
@@ -91,6 +100,7 @@
type: Opaque
data:
magnum.conf: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.magnum | b64enc }}
+ magnum-api-uwsgi.ini: {{ include "helm-toolkit.utils.to_oslo_conf" .Values.conf.magnum_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 }}
diff --git a/charts/magnum/templates/deployment-api.yaml b/charts/magnum/templates/deployment-api.yaml
index fbb43d2..9eb4967 100644
--- a/charts/magnum/templates/deployment-api.yaml
+++ b/charts/magnum/templates/deployment-api.yaml
@@ -75,7 +75,7 @@
scheme: HTTP
path: /
port: {{ tuple "container-infra" "internal" "api" . | include "helm-toolkit.endpoints.endpoint_port_lookup" }}
- initialDelaySeconds: 15
+ initialDelaySeconds: 5
periodSeconds: 10
volumeMounts:
- name: pod-tmp
@@ -92,6 +92,10 @@
mountPath: /etc/magnum/magnum.conf
subPath: magnum.conf
readOnly: true
+ - name: magnum-etc
+ mountPath: /etc/magnum/magnum-api-uwsgi.ini
+ subPath: magnum-api-uwsgi.ini
+ readOnly: true
{{- if .Values.conf.magnum.DEFAULT.log_config_append }}
- name: magnum-etc
mountPath: {{ .Values.conf.magnum.DEFAULT.log_config_append }}
diff --git a/charts/magnum/values.yaml b/charts/magnum/values.yaml
index 91a5055..56232eb 100644
--- a/charts/magnum/values.yaml
+++ b/charts/magnum/values.yaml
@@ -157,6 +157,22 @@
formatter_default:
format: "%(message)s"
datefmt: "%Y-%m-%d %H:%M:%S"
+ magnum_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: "magnum-api:"
+ route-user-agent: '^kube-probe.* donotlog:'
+ thunder-lock: true
+ worker-reload-mercy: 80
+ wsgi-file: /var/lib/openstack/bin/magnum-api-wsgi
network:
api: