Add wsgi module to Designate and remove wsgi script

Changes in python packaging tooling mean that the wsgi_scripts
functionality via PBR may not longer function.

This patch switches Designate from using the PBR wsgi_scripts method to
using a new wsgi module that provides the same behavior as the generated
wsgi scripts provided.

A related devstack patch enables devstack to setup uWSGI to use the new
module path instead of the generated wsgi scripts.

This also aligns Designate to a new proposed OpenStack goal[1].

[1] https://review.opendev.org/c/openstack/governance/+/902807

In order to make the CI work, this patch was merged with:

zuul: Drop centos9 and make grenade non-voting

The requirements repo has dropped upper-constraints for python3.9, so
the centos9-based jobs are no longer working on master, let's drop them.

Also the grenade jobs are broken due to the referenced bug, make them
temporarily non-voting, so that we can merge the fix[0] on master first,
backport it, and then re-enable them.

[0] https://review.opendev.org/c/openstack/designate/+/902846

Related-Bug: 2109577
Depends-On: https://review.opendev.org/c/openstack/devstack/+/902758
Change-Id: If90056ae1de4a6a3557fc870497e6233088bfb02
This commit is contained in:
Michael Johnson 2023-12-06 21:53:18 +00:00
parent 595894be22
commit e6d83dfcf7
7 changed files with 57 additions and 30 deletions

View File

@ -51,16 +51,6 @@
post-run: playbooks/designate-bind9/post.yaml
parent: designate-base
- job:
name: designate-bind9-centos9stream-fips
parent: designate-bind9
nodeset: devstack-single-node-centos-9-stream
description: |
Functional testing for a FIPS enabled Centos 9 stream system
pre-run: playbooks/enable-fips.yaml
vars:
nslookup_target: 'opendev.org'
- job:
name: designate-bind9-keystone-old-default-roles
post-run: playbooks/designate-bind9/post.yaml
@ -83,15 +73,6 @@
enforce_scope:
designate: False
- job:
name: designate-bind9-centos-9-stream
parent: designate-bind9
nodeset: devstack-single-node-centos-9-stream
vars:
devstack_localrc:
DESIGNATE_COORDINATION_URL: "etcd3+http://{{ hostvars['controller']['nodepool']['private_ipv4'] }}:2379?api_version=v3"
- job:
name: designate-bind9-catalog-zones
parent: designate-bind9
@ -218,14 +199,11 @@
check:
jobs:
- designate-bind9
- designate-bind9-centos9stream-fips:
voting: false
- designate-bind9-centos-9-stream:
voting: false
- designate-bind9-keystone-old-default-roles
- designate-pdns4
- designate-grenade-bind9
- designate-grenade-pdns4
- designate-grenade-pdns4:
voting: false
- designate-grenade-bind9-skip-level
- designate-grenade-pdns4-skip-level
- designate-ipv6-only-pdns4
@ -236,7 +214,6 @@
- designate-bind9
- designate-bind9-keystone-old-default-roles
- designate-pdns4
- designate-grenade-pdns4
- designate-grenade-pdns4-skip-level
- designate-ipv6-only-pdns4
- designate-ipv6-only-bind9

View File

24
designate/wsgi/api.py Normal file
View File

@ -0,0 +1,24 @@
# 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.
"""WSGI application entry-point for the Designate API."""
import threading
from designate.api import wsgi
application = None
lock = threading.Lock()
with lock:
if application is None:
application = wsgi.init_application()

View File

@ -1,7 +1,7 @@
#!/usr/bin/env bash
function designate_configure_uwsgi {
write_uwsgi_config "$DESIGNATE_UWSGI_CONF" "$DESIGNATE_UWSGI" "/dns"
write_uwsgi_config "$DESIGNATE_UWSGI_CONF" "$DESIGNATE_UWSGI" "/dns" "" "designate-api-wsgi"
# We are using the http transport to work around an issue with
# broken connections when using the uwsgi protocol of a local socket

View File

@ -60,7 +60,7 @@ DESIGNATE_ROOTWRAP_CONF=$DESIGNATE_CONF_DIR/rootwrap.conf
DESIGNATE_APIPASTE_CONF=$DESIGNATE_CONF_DIR/api-paste.ini
DESIGNATE_PLUGINS=$DESIGNATE_DIR/devstack/designate_plugins
DESIGNATE_UWSGI=$DESIGNATE_BIN_DIR/designate-api-wsgi
DESIGNATE_UWSGI=designate.wsgi.api:application
DESIGNATE_UWSGI_CONF=$DESIGNATE_CONF_DIR/designate-api-uwsgi.ini
# Default repositories

View File

@ -0,0 +1,29 @@
---
features:
- |
A new module, ``designate.wsgi``, has been added as a place to gather WSGI
``application`` objects. This is intended to ease deployment by providing
a consistent location for these objects. For example, if using uWSGI then
instead of:
.. code-block:: ini
[uwsgi]
wsgi-file = /bin/designate-api-wsgi
You can now use:
.. code-block:: ini
[uwsgi]
module = designate.wsgi.api:application
This also simplifies deployment with other WSGI servers that expect module
paths such as gunicorn.
upgrade:
- |
The WSGI script ``designate-api-wsgi`` has been removed. Deployment tooling
should instead reference the Python module path for the wsgi module in
Designate, ``designate.wsgi.api:application`` if their chosen WSGI server
supports this (gunicorn, uWSGI, etc.) or implement a .wsgi script
themselves if not (mod_wsgi).

View File

@ -119,6 +119,3 @@ designate.heartbeat_emitter =
designate.notification.plugin =
default = designate.notifications:Default
audit = designate.notifications:Audit
wsgi_scripts =
designate-api-wsgi = designate.api.wsgi:init_application