diff --git a/images/magnum/Dockerfile b/images/magnum/Dockerfile index fa4cdd2b..3c0ce0f6 100644 --- a/images/magnum/Dockerfile +++ b/images/magnum/Dockerfile @@ -16,6 +16,7 @@ FROM vexxhost/python-builder AS builder FROM vexxhost/python-base AS magnum-api +COPY magnum-api-wsgi /usr/local/bin/magnum-api-wsgi EXPOSE 9511 ENV UWSGI_HTTP_SOCKET=:9511 UWSGI_WSGI_FILE=/usr/local/bin/magnum-api-wsgi CMD ["/usr/local/bin/uwsgi","--ini","/etc/uwsgi/uwsgi.ini"] diff --git a/images/magnum/magnum-api-wsgi b/images/magnum/magnum-api-wsgi new file mode 100755 index 00000000..de3dd1fd --- /dev/null +++ b/images/magnum/magnum-api-wsgi @@ -0,0 +1,33 @@ +#!/usr/local/bin/python +# Copyright (c) 2020 VEXXHOST, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import pkg_resources + +import sentry_sdk + +from magnum.api.app import build_wsgi_app +from sentry_sdk.integrations import wsgi + + +VERSION = pkg_resources.get_distribution("magnum").version + +sentry_sdk.init( + release="magnum@%s" % VERSION, + traces_sample_rate=0.1 +) + +application = build_wsgi_app() +application = wsgi.SentryWsgiMiddleware(application) diff --git a/images/magnum/requirements.txt b/images/magnum/requirements.txt index 4579e8d7..be8c907c 100644 --- a/images/magnum/requirements.txt +++ b/images/magnum/requirements.txt @@ -1,4 +1,5 @@ uWSGI python-memcached PyMySQL +sentry-sdk git+https://opendev.org/openstack/magnum@stable/ussuri \ No newline at end of file diff --git a/openstack_operator/templates/magnum/daemonset.yml.j2 b/openstack_operator/templates/magnum/daemonset.yml.j2 index 31416f88..184dc3f4 100644 --- a/openstack_operator/templates/magnum/daemonset.yml.j2 +++ b/openstack_operator/templates/magnum/daemonset.yml.j2 @@ -54,6 +54,10 @@ spec: imagePullPolicy: Always {% if env is defined and env|length %} env: + {% if 'sentryDSN' in spec %} + - name: SENTRY_DSN + value: {{ spec.sentryDSN }} + {% endif %} {% for v in env %} - name: "{{ v.name }}" value: "{{ v.value }}"