From 183e37541dccb1eae131250868dc52e0eb9b06c9 Mon Sep 17 00:00:00 2001 From: Drew Walters Date: Tue, 9 Oct 2018 18:49:34 +0000 Subject: [PATCH] api: Replace conflicting environment variable The Armada API relies on an environment variable, `ARMADA_API_PORT`, to start uWSGI with the desired port; however, it conflicts with an environment variable already in use. This causes the `entrypoint.sh` script to use the wrong port value for uWSGI when using user-specified `armada_api` values through Helm (i.e. the port is already set and the `entrypoint.sh` script does not fallback on its default value). This commit adds missing uWSGI configuration values to the Armada chart values and changes their names to avoid potential conflicts. Change-Id: I00ae3431e36593956705dcdb887025d688d804df --- charts/armada/values.yaml | 15 ++++++++++++--- entrypoint.sh | 16 ++++++++-------- 2 files changed, 20 insertions(+), 11 deletions(-) diff --git a/charts/armada/values.yaml b/charts/armada/values.yaml index 0cb11ff5..406ec279 100644 --- a/charts/armada/values.yaml +++ b/charts/armada/values.yaml @@ -197,10 +197,19 @@ conf: pod: env: + # NOTE(@drewwalters96): These configuration values change the Armada API's + # uWSGI configuration. armada_api: -# ARMADA_API_PORT should = conf.armada.armada_api.bind_port in standard cases - - name: ARMADA_API_PORT - value: 8000 +# # NOTE: ARMADA_UWSGI_PORT should match conf.armada.armada_api.bind_port in +# # standard use cases +# - name: ARMADA_UWSGI_PORT +# value: "8000" +# - name: ARMADA_UWSGI_TIMEOUT +# value: "3600" +# - name: ARMADA_UWSGI_WORKERS +# value: "4" +# - name: ARMADA_UWSGI_THREADS +# value: "1" # - name: http_proxy # value: http://proxy.example.com:8080 # - name: https_proxy diff --git a/entrypoint.sh b/entrypoint.sh index 559e5a3e..13211bf4 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -19,13 +19,13 @@ set -ex CMD="armada" # Define port -ARMADA_API_PORT=${ARMADA_API_PORT:-8000} +ARMADA_UWSGI_PORT=${ARMADA_UWSGI_PORT:-8000} # How long uWSGI should wait for each Armada response -ARMADA_API_TIMEOUT=${ARMADA_API_TIMEOUT:-"3600"} +ARMADA_UWSGI_TIMEOUT=${ARMADA_UWSGI_TIMEOUT:-"3600"} # Number of uWSGI workers to handle API requests -ARMADA_API_WORKERS=${ARMADA_API_WORKERS:-"4"} +ARMADA_UWSGI_WORKERS=${ARMADA_UWSGI_WORKERS:-"4"} # Threads per worker -ARMADA_API_THREADS=${ARMADA_API_THREADS:-"1"} +ARMADA_UWSGI_THREADS=${ARMADA_UWSGI_THREADS:-"1"} # Start Armada application # TODO(fmontei): Should be specifying callable too. But Armada spins up the @@ -34,16 +34,16 @@ if [ "$1" = 'server' ]; then exec uwsgi \ -b 32768 \ --die-on-term \ - --http :${ARMADA_API_PORT} \ - --http-timeout $ARMADA_API_TIMEOUT \ + --http :${ARMADA_UWSGI_PORT} \ + --http-timeout $ARMADA_UWSGI_TIMEOUT \ --enable-threads \ -L \ --lazy-apps \ --master \ --paste config:/etc/armada/api-paste.ini \ --pyargv "--config-file /etc/armada/armada.conf" \ - --threads $ARMADA_API_THREADS \ - --workers $ARMADA_API_WORKERS + --threads $ARMADA_UWSGI_THREADS \ + --workers $ARMADA_UWSGI_WORKERS else exec $CMD "$@" fi