Browse Source

Migrate existing Devstack integration into a Devstack plugin

This patch will not remove the existing Devstack integration
in contrib/devstack.

Change-Id: I23ef00bb136e92abc5e69a9bbe1093cad9d2a362
Closes-bug: #1504214
Christian Berendt 3 years ago
parent
commit
bb1b24c25a

+ 2
- 20
contrib/devstack/gate_hook.sh View File

@@ -2,23 +2,5 @@
2 2
 
3 3
 set -ex
4 4
 
5
-pushd $BASE/new/devstack
6
-
7
-DEVSTACK_GATE_DESIGNATE_DRIVER=${DEVSTACK_GATE_DESIGNATE_DRIVER:-powerdns}
8
-
9
-export KEEP_LOCALRC=1
10
-export ENABLED_SERVICES=designate,designate-api,designate-central,designate-sink,designate-mdns,designate-pool-manager,designate-zone-manager
11
-
12
-echo "DESIGNATE_SERVICE_PORT_DNS=5322" >> $BASE/new/devstack/localrc
13
-echo "DESIGNATE_BACKEND_DRIVER=$DEVSTACK_GATE_DESIGNATE_DRIVER" >> $BASE/new/devstack/localrc
14
-echo "DESIGNATE_PERIODIC_RECOVERY_INTERVAL=20" >> $BASE/new/devstack/localrc
15
-echo "DESIGNATE_PERIODIC_SYNC_INTERVAL=20" >> $BASE/new/devstack/localrc
16
-
17
-
18
-# Pass through any DESIGNATE_ env vars to the localrc file
19
-env | grep -E "^DESIGNATE_" >> $BASE/new/devstack/localrc || :
20
-
21
-popd
22
-
23
-# Run DevStack Gate
24
-$BASE/new/devstack-gate/devstack-vm-gate.sh
5
+cd /opt/stack/new/designate/devstack/gate
6
+./gate_hook.sh

+ 2
- 5
contrib/devstack/post_test_hook.sh View File

@@ -2,8 +2,5 @@
2 2
 
3 3
 set -ex
4 4
 
5
-# Run the Designate DevStack exercises
6
-$BASE/new/devstack/exercises/designate.sh
7
-
8
-# Run the Designate Tempest tests
9
-sudo ./run_tempest_tests.sh
5
+cd /opt/stack/new/designate/devstack/gate
6
+./post_test_hook.sh

+ 4
- 30
contrib/devstack/run_tempest_tests.sh View File

@@ -1,32 +1,6 @@
1
-#!/bin/bash -e
2
-#
3
-# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
-# not use this file except in compliance with the License. You may obtain
5
-# a copy of the License at
6
-#
7
-#      http://www.apache.org/licenses/LICENSE-2.0
8
-#
9
-# Unless required by applicable law or agreed to in writing, software
10
-# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
-# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
-# License for the specific language governing permissions and limitations
13
-# under the License.
1
+#!/bin/bash
14 2
 
15
-# How many seconds to wait for the API to be responding before giving up
16
-API_RESPONDING_TIMEOUT=20
3
+set -ex
17 4
 
18
-if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:9001/ 2>/dev/null | grep -q 'v1' ; do sleep 1; done"; then
19
-    echo "The Designate API failed to respond within ${API_RESPONDING_TIMEOUT} seconds"
20
-    exit 1
21
-fi
22
-
23
-echo "Successfully contacted the Designate API"
24
-
25
-# Where Designate and Tempest code lives
26
-DESIGNATE_DIR=${DESIGNATE_DIR:-/opt/stack/new/designate}
27
-TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest}
28
-
29
-
30
-pushd $DESIGNATE_DIR
31
-export TEMPEST_CONFIG=$TEMPEST_DIR/etc/tempest.conf
32
-tox -e functional
5
+cd /opt/stack/new/designate/devstack/gate
6
+./run_tempest_tests.sh

+ 0
- 9
contrib/vagrant/Vagrantfile View File

@@ -78,15 +78,6 @@ if [ ! -f "/home/vagrant/devstack/localrc" ]; then
78 78
     cp localrc /home/vagrant/devstack/localrc
79 79
 fi
80 80
 
81
-# Install Designate DevStack extension
82
-cd /opt/stack/designate/contrib/devstack
83
-
84
-for f in lib/* extras.d/* exercises/*; do
85
-    if [ ! -f "/home/vagrant/devstack/$f" ]; then
86
-        ln -fs /opt/stack/designate/contrib/devstack/$f -t /home/vagrant/devstack/$(dirname $f)
87
-    fi
88
-done
89
-
90 81
 # Link in any Rally Plugins
91 82
 mkdir /home/vagrant/.rally
92 83
 ln -s /opt/stack/designate/rally-scenarios/plugins /home/vagrant/.rally/plugins

+ 3
- 0
contrib/vagrant/localrc View File

@@ -18,6 +18,9 @@ LOG_COLOR=True
18 18
 # Enable the basic services we require
19 19
 ENABLED_SERVICES=rabbit,mysql,key
20 20
 
21
+# Enable designate
22
+enable_plugin designate https://git.openstack.org/openstack/designate
23
+
21 24
 # Designate Devstack Config
22 25
 # =========================
23 26
 # Enable core Designate services

+ 16
- 0
devstack/README.rst View File

@@ -0,0 +1,16 @@
1
+====================
2
+Enabling in Devstack
3
+====================
4
+
5
+1. Download DevStack::
6
+
7
+    git clone https://git.openstack.org/openstack-dev/devstack.git
8
+    cd devstack
9
+
10
+2. Add this repo as an external repository::
11
+
12
+     > cat local.conf
13
+     [[local|localrc]]
14
+     enable_plugin designate https://git.openstack.org/openstack/designate
15
+
16
+3. run ``stack.sh``

+ 116
- 0
devstack/designate_plugins/backend-akamai View File

@@ -0,0 +1,116 @@
1
+# Configure the Akamai backend
2
+
3
+# Requirements:
4
+# An active Akamai account / contract will be requied to use this DevStack
5
+# plugin.
6
+
7
+# Enable with:
8
+# DESIGNATE_BACKEND_DRIVER=akamai
9
+
10
+# Dependencies:
11
+# ``functions`` file
12
+# ``designate`` configuration
13
+
14
+# install_designate_backend - install any external requirements
15
+# configure_designate_backend - make configuration changes, including those to other services
16
+# init_designate_backend - initialize databases, etc.
17
+# start_designate_backend - start any external services
18
+# stop_designate_backend - stop any external services
19
+# cleanup_designate_backend - remove transient data and cache
20
+
21
+# Save trace setting
22
+DP_AKAMAI_XTRACE=$(set +o | grep xtrace)
23
+set +o xtrace
24
+
25
+# Defaults
26
+# --------
27
+
28
+DESIGNATE_AKAMAI_USERNAME=${DESIGNATE_AKAMAI_USERNAME:-username}
29
+DESIGNATE_AKAMAI_PASSWORD=${DESIGNATE_AKAMAI_PASSWORD:-password}
30
+DESIGNATE_AKAMAI_MASTERS=${DESIGNATE_AKAMAI_MASTERS:-"$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS"}
31
+DESIGNATE_AKAMAI_NAMESERVERS=${DESIGNATE_AKAMAI_NAMESERVERS:-""}
32
+DESIGNATE_AKAMAI_ALSO_NOTIFIES=${DESIGNATE_AKAMAI_ALSO_NOTIFIES:-"193.108.155.34:53,23.73.134.141:53,80.67.64.148:53,23.73.134.237:53,23.73.133.141:53,23.73.133.237:53,80.67.64.10:53,72.246.0.10:53,72.247.45.157:53,72.246.192.168:53,193.108.152.143:53,60.254.128.45:53,72.247.45.110:53,72.247.45.65:53,72.247.45.25:53"}
33
+
34
+# Pull in DESIGNATE_3RDPARTY_CREDS user/pass if set
35
+if [ -n "$DESIGNATE_3RDPARTY_CREDS" ]; then
36
+    DESIGNATE_AKAMAI_USERNAME=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f1 -d:`
37
+    DESIGNATE_AKAMAI_PASSWORD=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f2- -d:`
38
+fi
39
+
40
+# Sanity Checks
41
+# -------------
42
+if [ -z "$DESIGNATE_AKAMAI_NAMESERVERS" ]; then
43
+    die $LINENO "You must configure DESIGNATE_AKAMAI_NAMESERVERS"
44
+fi
45
+
46
+if [ "$DESIGNATE_SERVICE_PORT_MDNS" != "53" ]; then
47
+    die $LINENO "Akamai requires DESIGNATE_SERVICE_PORT_MDNS is set to '53'"
48
+fi
49
+
50
+# Entry Points
51
+# ------------
52
+
53
+# install_designate_backend - install any external requirements
54
+function install_designate_backend {
55
+    :
56
+}
57
+
58
+# configure_designate_backend - make configuration changes, including those to other services
59
+function configure_designate_backend {
60
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type akamai
61
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_AKAMAI_MASTERS
62
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "username: $DESIGNATE_AKAMAI_USERNAME, password: $DESIGNATE_AKAMAI_PASSWORD"
63
+
64
+    # Create a Pool Nameserver for each of the Akamai nameservers
65
+    local nameserver_ids=""
66
+    IFS=',' read -a nameservers <<< "$DESIGNATE_AKAMAI_NAMESERVERS"
67
+
68
+    for nameserver in "${nameservers[@]}"; do
69
+        local nameserver_id=`uuidgen`
70
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $(dig +short A $nameserver | head -n 1)
71
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port 53
72
+
73
+        # Append the Nameserver ID to the list
74
+        nameserver_ids+=${nameserver_id},
75
+    done
76
+
77
+    # Configure the Pool for the set of nameserver IDs, minus the trailing comma
78
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers "${nameserver_ids:0:-1}"
79
+
80
+    # Configure the Pool to Notify Akamai's Transfer Agents
81
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID also_notifies "$DESIGNATE_AKAMAI_ALSO_NOTIFIES"
82
+}
83
+
84
+# create_designate_ns_records - Create Pool NS Records
85
+function create_designate_ns_records_backend {
86
+    # Build an array of the Akamai nameservers.
87
+    IFS=',' read -a ns_records <<< "$DESIGNATE_AKAMAI_NAMESERVERS"
88
+
89
+    # Create a NS Record for each of the Akamai nameservers
90
+    for ns_record in "${ns_records[@]}"; do
91
+        designate server-create --name "${ns_record%%.}."
92
+    done
93
+}
94
+
95
+# init_designate_backend - initialize databases, etc.
96
+function init_designate_backend {
97
+    :
98
+}
99
+
100
+# start_designate_backend - start any external services
101
+function start_designate_backend {
102
+    :
103
+}
104
+
105
+# stop_designate_backend - stop any external services
106
+function stop_designate_backend {
107
+    :
108
+}
109
+
110
+# cleanup_designate_backend - remove transient data and cache
111
+function cleanup_designate_backend {
112
+    :
113
+}
114
+
115
+# Restore xtrace
116
+$DP_AKAMAI_XTRACE

+ 153
- 0
devstack/designate_plugins/backend-bind9 View File

@@ -0,0 +1,153 @@
1
+# Configure the bind9 pool backend
2
+
3
+# Enable with:
4
+# DESIGNATE_BACKEND_DRIVER=bind9
5
+
6
+# Dependencies:
7
+# ``functions`` file
8
+# ``designate`` configuration
9
+
10
+# install_designate_backend - install any external requirements
11
+# configure_designate_backend - make configuration changes, including those to other services
12
+# init_designate_backend - initialize databases, etc.
13
+# start_designate_backend - start any external services
14
+# stop_designate_backend - stop any external services
15
+# cleanup_designate_backend - remove transient data and cache
16
+
17
+# Save trace setting
18
+DP_BIND9_XTRACE=$(set +o | grep xtrace)
19
+set +o xtrace
20
+
21
+# Defaults
22
+# --------
23
+BIND_SERVICE_NAME=bind9
24
+BIND_CFG_DIR=/etc/bind
25
+BIND_VAR_DIR=/var/cache/bind
26
+BIND_CFG_FILE=$BIND_CFG_DIR/named.conf.options
27
+BIND_USER=bind
28
+BIND_GROUP=bind
29
+DESIGNATE_SERVICE_PORT_RNDC=${DESIGNATE_SERVICE_PORT_RNDC:-953}
30
+
31
+if is_fedora; then
32
+    BIND_SERVICE_NAME=named
33
+    BIND_CFG_DIR=/etc/named
34
+    BIND_CFG_FILE=/etc/named.conf
35
+    BIND_VAR_DIR=/var/named
36
+    BIND_USER=named
37
+    BIND_GROUP=named
38
+fi
39
+
40
+# Entry Points
41
+# ------------
42
+
43
+# install_designate_backend - install any external requirements
44
+function install_designate_backend {
45
+    if is_ubuntu; then
46
+        install_package bind9
47
+    elif is_fedora; then
48
+        install_package named
49
+    fi
50
+
51
+    # The user that designate runs as needs to be member of **$BIND_GROUP** group.
52
+    # The designate bind9 backend needs read/write access to $BIND_VAR_DIR
53
+    if ! getent group $BIND_GROUP >/dev/null; then
54
+        sudo groupadd $BIND_GROUP
55
+    fi
56
+    add_user_to_group $STACK_USER $BIND_GROUP
57
+    if [[ ! -d $BIND_CFG_DIR ]]; then
58
+        sudo mkdir -p $BIND_CFG_DIR
59
+        sudo chown $BIND_USER:$BIND_GROUP $BIND_CFG_DIR
60
+    fi
61
+
62
+    sudo chown -R $BIND_USER:$BIND_GROUP $BIND_CFG_DIR $BIND_VAR_DIR
63
+    sudo chmod -R g+r $BIND_CFG_DIR
64
+    sudo chmod -R g+rw $BIND_VAR_DIR
65
+
66
+    # Customize Bind9 apparmor profile if installed
67
+    if [[ -d /etc/apparmor.d ]]; then
68
+        sudo tee /etc/apparmor.d/local/usr.sbin.named > /dev/null << EOF
69
+$DESIGNATE_STATE_PATH/bind9/** rw,
70
+EOF
71
+        restart_service apparmor
72
+    fi
73
+}
74
+
75
+# configure_designate_backend - make configuration changes, including those to other services
76
+function configure_designate_backend {
77
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type bind9
78
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS
79
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "rndc_host: $DESIGNATE_SERVICE_HOST, rndc_port: $DESIGNATE_SERVICE_PORT_RNDC, rndc_config_file: $BIND_CFG_DIR/rndc.conf, rndc_key_file: $BIND_CFG_DIR/rndc.key, host: $DESIGNATE_SERVICE_HOST, port: $DESIGNATE_SERVICE_PORT_DNS"
80
+
81
+    # DevStack Managed BIND NameServer
82
+    local nameserver_id=`uuidgen`
83
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers $nameserver_id
84
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $DESIGNATE_SERVICE_HOST
85
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port $DESIGNATE_SERVICE_PORT_DNS
86
+
87
+    sudo chown $STACK_USER $BIND_CFG_DIR
88
+
89
+    # create rndc key and config
90
+    sudo rndc-confgen -a -c $BIND_CFG_DIR/rndc.key
91
+    sudo chown $BIND_USER:$BIND_GROUP $BIND_CFG_DIR/rndc.key
92
+    sudo chmod g+r $BIND_CFG_DIR/rndc.key
93
+
94
+    # Configure Bind
95
+    sudo tee $BIND_CFG_FILE > /dev/null <<EOF
96
+include "$BIND_CFG_DIR/rndc.key";
97
+
98
+options {
99
+    directory "$BIND_VAR_DIR";
100
+    allow-new-zones yes;
101
+    dnssec-validation auto;
102
+    auth-nxdomain no;    # conform to RFC1035
103
+    listen-on port $DESIGNATE_SERVICE_PORT_DNS { $DESIGNATE_SERVICE_HOST; };
104
+    recursion no;
105
+    minimal-responses yes;
106
+};
107
+
108
+controls {
109
+    inet $DESIGNATE_SERVICE_HOST port $DESIGNATE_SERVICE_PORT_RNDC allow { $DESIGNATE_SERVICE_HOST; } keys { "rndc-key"; };
110
+};
111
+EOF
112
+
113
+    # Configure RNDC
114
+    sudo tee $BIND_CFG_DIR/rndc.conf > /dev/null << EOF
115
+include "$BIND_CFG_DIR/rndc.key";
116
+
117
+options {
118
+    default-key "rndc-key";
119
+    default-server $DESIGNATE_SERVICE_HOST;
120
+    default-port $DESIGNATE_SERVICE_PORT_RNDC;
121
+};
122
+EOF
123
+
124
+    sudo chown $BIND_USER:$BIND_GROUP $BIND_CFG_FILE $BIND_CFG_DIR/rndc.conf
125
+    sudo chmod g+r $BIND_CFG_FILE $BIND_CFG_DIR/rndc.conf
126
+
127
+    restart_service $BIND_SERVICE_NAME
128
+}
129
+
130
+# init_designate_backend - initialize databases, etc.
131
+function init_designate_backend {
132
+    :
133
+}
134
+
135
+# start_designate_backend - start any external services
136
+function start_designate_backend {
137
+    start_service bind9
138
+}
139
+
140
+# stop_designate_backend - stop any external services
141
+function stop_designate_backend {
142
+    stop_service bind9
143
+}
144
+
145
+# cleanup_designate_backend - remove transient data and cache
146
+function cleanup_designate_backend {
147
+    sudo sh -c "rm -rf $BIND_VAR_DIR/*.nzf"
148
+    sudo sh -c "rm -rf $BIND_VAR_DIR/slave.*"
149
+    sudo rm -f $BIND_CFG_DIR/rndc.key
150
+}
151
+
152
+# Restore xtrace
153
+$DP_BIND9_XTRACE

+ 135
- 0
devstack/designate_plugins/backend-designate View File

@@ -0,0 +1,135 @@
1
+# Configure the designate backend
2
+
3
+# Requirements:
4
+# Another Designate service is needed in order to install the SECONDARY zones in it.
5
+
6
+# Enable with:
7
+# DESIGNATE_BACKEND_DRIVER=designate
8
+
9
+# Dependencies:
10
+# ``functions`` file
11
+# ``designate`` configuration
12
+
13
+# install_designate_backend - install any external requirements
14
+# configure_designate_backend - make configuration changes, including those to other services
15
+# init_designate_backend - initialize databases, etc.
16
+# start_designate_backend - start any external services
17
+# stop_designate_backend - stop any external services
18
+# cleanup_designate_backend - remove transient data and cache
19
+
20
+# Save trace setting
21
+DP_D2D_XTRACE=$(set +o | grep xtrace)
22
+set +o xtrace
23
+
24
+# Defaults
25
+# --------
26
+
27
+# This is the Primary Designate MDNS servers.
28
+DESIGNATE_D2D_MASTERS=${DESIGNATE_D2D_MASTERS:-""}
29
+
30
+# DNS server to notify (MiniDNS ip:port)
31
+DESIGNATE_D2D_ALSO_NOTIES=${DESIGNATE_D2D_ALSO_NOTIES:-""}
32
+
33
+# DNS server to check SOA etc against
34
+DESIGNATE_D2D_NAMESERVERS=${DESIGNATE_D2D_NAMESERVERS:-""}
35
+
36
+# Destination openstack credentials
37
+DESIGNATE_D2D_KS_VERSION=${DESIGNATE_D2D_KS_VERSION:-3}
38
+
39
+DESIGNATE_D2D_AUTH_URL=${DESIGNATE_D2D_AUTH_URL:-}
40
+DESIGNATE_D2D_USERNAME=${DESIGNATE_D2D_USERNAME:-}
41
+DESIGNATE_D2D_PASSWORD=${DESIGNATE_D2D_PASSWORD:-}
42
+
43
+# Keystone V2
44
+DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_NAME:-}
45
+DESIGNATE_D2D_TENANT_NAME=${DESIGNATE_D2D_TENANT_ID:-}
46
+
47
+# Keystone V3
48
+DESIGNATE_D2D_PROJECT_NAME=${DESIGNATE_D2D_PROJECT_NAME:-}
49
+DESIGNATE_D2D_PROJECT_DOMAIN_NAME=${DESIGNATE_D2D_PROJECT_DOMAIN_NAME:-}
50
+DESIGNATE_D2D_USER_DOMAIN_NAME=${DESIGNATE_D2D_USER_DOMAIN_NAME:-}
51
+
52
+
53
+# Entry Points
54
+# ------------
55
+
56
+# install_designate_backend - install any external requirements
57
+function install_designate_backend {
58
+    :
59
+}
60
+
61
+# configure_designate_backend - make configuration changes, including those to other services
62
+function configure_designate_backend {
63
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type designate
64
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_D2D_MASTERS
65
+
66
+    options="auth_url: $DESIGNATE_D2D_AUTH_URL, username: $DESIGNATE_D2D_USERNAME, password: $DESIGNATE_D2D_PASSWORD,"
67
+    if [ "$DESIGNATE_D2D_KS_VERSION" == "2" ]; then
68
+        if [ ! -z "$DESIGNATE_D2D_TENANT_NAME" ]; then
69
+        options="$options tenant_name=$DESIGNATE_D2D_TENANT_NAME,"
70
+        fi
71
+
72
+        if [ ! -z "$DESIGNATE_D2D_TENANT_ID" ]; then
73
+            options="$options tenant_id=$DESIGNATE_D2D_TENANT_ID,"
74
+        fi
75
+    fi
76
+
77
+    if [ ! -z "$DESIGNATE_D2D_KS_VERSION" == "3" ]; then
78
+        options="$options project_name: $DESIGNATE_D2D_PROJECT_NAME, project_domain_name=$DESIGNATE_D2D_PROJECT_DOMAIN_NAME, user_domain_name=$DESIGNATE_D2D_USER_DOMAIN_NAME"
79
+    fi
80
+
81
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options $options
82
+
83
+    # Create a Pool Nameserver for each of the Designate nameservers
84
+    local nameserver_ids=""
85
+    IFS=',' read -a nameservers <<< "$DESIGNATE_D2D_NAMESERVERS"
86
+
87
+    for nameserver in "${nameservers[@]}"; do
88
+        local nameserver_id=`uuidgen`
89
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $(dig +short A $nameserver | head -n 1)
90
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port 53
91
+
92
+        # Append the Nameserver ID to the list
93
+        nameserver_ids+=${nameserver_id},
94
+    done
95
+
96
+    # Configure the Pool for the set of nameserver IDs, minus the trailing comma
97
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers "${nameserver_ids:0:-1}"
98
+
99
+    # Configure the Pool to Notify the destination Mdns
100
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID also_notifies "$DESIGNATE_D2D_ALSO_NOTIFIES"
101
+}
102
+
103
+# create_designate_ns_records - Create Pool NS Records
104
+function create_designate_ns_records_backend {
105
+    # Build an array of the Designate nameservers.
106
+    IFS=',' read -a ns_records <<< "$DESIGNATE_D2D_NAMESERVERS"
107
+
108
+    # Create a NS Record for each of the Designate nameservers
109
+    for ns_record in "${ns_records[@]}"; do
110
+        designate server-create --name "${ns_record%%.}."
111
+    done
112
+}
113
+
114
+# init_designate_backend - initialize databases, etc.
115
+function init_designate_backend {
116
+    :
117
+}
118
+
119
+# start_designate_backend - start any external services
120
+function start_designate_backend {
121
+    :
122
+}
123
+
124
+# stop_designate_backend - stop any external services
125
+function stop_designate_backend {
126
+    :
127
+}
128
+
129
+# cleanup_designate_backend - remove transient data and cache
130
+function cleanup_designate_backend {
131
+    :
132
+}
133
+
134
+# Restore xtrace
135
+$DP_D2D_XTRACE

+ 130
- 0
devstack/designate_plugins/backend-dynect View File

@@ -0,0 +1,130 @@
1
+# Configure the dynect backend
2
+
3
+# Requirements:
4
+# An active DynECT account / contract will be requied to use this DevStack
5
+# plugin.
6
+
7
+# Enable with:
8
+# DESIGNATE_BACKEND_DRIVER=dynect
9
+
10
+# Dependencies:
11
+# ``functions`` file
12
+# ``designate`` configuration
13
+
14
+# install_designate_backend - install any external requirements
15
+# configure_designate_backend - make configuration changes, including those to other services
16
+# init_designate_backend - initialize databases, etc.
17
+# start_designate_backend - start any external services
18
+# stop_designate_backend - stop any external services
19
+# cleanup_designate_backend - remove transient data and cache
20
+
21
+# Save trace setting
22
+DP_DYNECT_XTRACE=$(set +o | grep xtrace)
23
+set +o xtrace
24
+
25
+# Defaults
26
+# --------
27
+
28
+DESIGNATE_DYNECT_CUSTOMER=${DESIGNATE_DYNECT_CUSTOMER:-customer}
29
+DESIGNATE_DYNECT_USERNAME=${DESIGNATE_DYNECT_USERNAME:-username}
30
+DESIGNATE_DYNECT_PASSWORD=${DESIGNATE_DYNECT_PASSWORD:-password}
31
+DESIGNATE_DYNECT_CONTACT_NICKNAME=${DESIGNATE_DYNECT_CONTACT_NICKNAME:-}
32
+DESIGNATE_DYNECT_JOB_TIMEOUT=${DESIGNATE_DYNECT_JOB_TIMEOUT:-}
33
+DESIGNATE_DYNECT_TIMEOUT=${DESIGNATE_DYNECT_TIMEOUT:-}
34
+DESIGNATE_DYNECT_MASTERS=${DESIGNATE_DYNECT_MASTERS:-"$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS"}
35
+DESIGNATE_DYNECT_NAMESERVERS=${DESIGNATE_DYNECT_NAMESERVERS:-""}
36
+DESIGNATE_DYNECT_ALSO_NOTIFIES=${DESIGNATE_DYNECT_ALSO_NOTIFIES:-"204.13.249.65:53,208.78.68.65:53"}
37
+
38
+# Pull in DESIGNATE_3RDPARTY_CREDS user/pass if set
39
+if [ -n "$DESIGNATE_3RDPARTY_CREDS" ]; then
40
+    DESIGNATE_DYNECT_CUSTOMER=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f1 -d:`
41
+    DESIGNATE_DYNECT_USERNAME=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f2 -d:`
42
+    DESIGNATE_DYNECT_PASSWORD=`echo $DESIGNATE_3RDPARTY_CREDS | cut -f3- -d:`
43
+fi
44
+
45
+# Sanity Checks
46
+# -------------
47
+if [ -z "$DESIGNATE_DYNECT_NAMESERVERS" ]; then
48
+    die $LINENO "You must configure DESIGNATE_DYNECT_NAMESERVERS"
49
+fi
50
+
51
+if [ "$DESIGNATE_SERVICE_PORT_MDNS" != "53" ]; then
52
+    die $LINENO "DynECT requires DESIGNATE_SERVICE_PORT_MDNS is set to '53'"
53
+fi
54
+
55
+# Entry Points
56
+# ------------
57
+
58
+# install_designate_backend - install any external requirements
59
+function install_designate_backend {
60
+    :
61
+}
62
+
63
+# configure_designate_backend - make configuration changes, including those to other services
64
+function configure_designate_backend {
65
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type dynect
66
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_DYNECT_MASTERS
67
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "customer_name: $DESIGNATE_DYNECT_CUSTOMER, username: $DESIGNATE_DYNECT_USERNAME, password: $DESIGNATE_DYNECT_PASSWORD"
68
+
69
+    # Create a Pool Nameserver for each of the DynECT nameservers
70
+    local nameserver_ids=""
71
+    IFS=',' read -a nameservers <<< "$DESIGNATE_DYNECT_NAMESERVERS"
72
+
73
+    for nameserver in "${nameservers[@]}"; do
74
+        local nameserver_id=`uuidgen`
75
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $(dig +short A $nameserver | head -n 1)
76
+        iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port 53
77
+
78
+        # Append the Nameserver ID to the list
79
+        nameserver_ids+=${nameserver_id},
80
+    done
81
+
82
+    # Configure the Pool for the set of nameserver IDs, minus the trailing comma
83
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers "${nameserver_ids:0:-1}"
84
+
85
+    # Configure the Pool to Notify DynECT's Transfer Agents
86
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID also_notifies "$DESIGNATE_DYNECT_ALSO_NOTIFIES"
87
+
88
+    # Global DynECT Backend Settings
89
+    if [ ! -z $DESIGNATE_DYNECT_JOB_TIMEOUT ]; then
90
+        iniset $DESIGNATE_CONF backend:dynect job_timeout "$DESIGNATE_DYNECT_JOB_TIMEOUT"
91
+    fi
92
+
93
+    if [ ! -z $DESIGNATE_DYNECT_TIMEOUT ]; then
94
+        iniset $DESIGNATE_CONF backend:dynect timeout "$DESIGNATE_DYNECT_TIMEOUT"
95
+    fi
96
+}
97
+
98
+# create_designate_ns_records - Create Pool NS Records
99
+function create_designate_ns_records_backend {
100
+    # Build an array of the DynECT nameservers.
101
+    IFS=',' read -a ns_records <<< "$DESIGNATE_DYNECT_NAMESERVERS"
102
+
103
+    # Create a NS Record for each of the DynECT nameservers
104
+    for ns_record in "${ns_records[@]}"; do
105
+        designate server-create --name "${ns_record%%.}."
106
+    done
107
+}
108
+
109
+# init_designate_backend - initialize databases, etc.
110
+function init_designate_backend {
111
+    :
112
+}
113
+
114
+# start_designate_backend - start any external services
115
+function start_designate_backend {
116
+    :
117
+}
118
+
119
+# stop_designate_backend - stop any external services
120
+function stop_designate_backend {
121
+    :
122
+}
123
+
124
+# cleanup_designate_backend - remove transient data and cache
125
+function cleanup_designate_backend {
126
+    :
127
+}
128
+
129
+# Restore xtrace
130
+$DP_DYNECT_XTRACE

+ 58
- 0
devstack/designate_plugins/backend-fake View File

@@ -0,0 +1,58 @@
1
+# Configure the fake backend
2
+
3
+# Enable with:
4
+# DESIGNATE_BACKEND_DRIVER=fake
5
+
6
+# Dependencies:
7
+# ``functions`` file
8
+# ``designate`` configuration
9
+
10
+# install_designate_backend - install any external requirements
11
+# configure_designate_backend - make configuration changes, including those to other services
12
+# init_designate_backend - initialize databases, etc.
13
+# start_designate_backend - start any external services
14
+# stop_designate_backend - stop any external services
15
+# cleanup_designate_backend - remove transient data and cache
16
+
17
+# Save trace setting
18
+DP_FAKE_XTRACE=$(set +o | grep xtrace)
19
+set +o xtrace
20
+
21
+# Defaults
22
+# --------
23
+
24
+# Entry Points
25
+# ------------
26
+
27
+# install_designate_backend - install any external requirements
28
+function install_designate_backend {
29
+    :
30
+}
31
+
32
+# configure_designate_backend - make configuration changes, including those to other services
33
+function configure_designate_backend {
34
+    :
35
+}
36
+
37
+# init_designate_backend - initialize databases, etc.
38
+function init_designate_backend {
39
+    :
40
+}
41
+
42
+# start_designate_backend - start any external services
43
+function start_designate_backend {
44
+    :
45
+}
46
+
47
+# stop_designate_backend - stop any external services
48
+function stop_designate_backend {
49
+    :
50
+}
51
+
52
+# cleanup_designate_backend - remove transient data and cache
53
+function cleanup_designate_backend {
54
+    :
55
+}
56
+
57
+# Restore xtrace
58
+$DP_FAKE_XTRACE

+ 98
- 0
devstack/designate_plugins/backend-infoblox View File

@@ -0,0 +1,98 @@
1
+# Configure the infoblox backend
2
+
3
+# Requirements:
4
+# A NIOS Grid Master or Cloud Network Automation appliance (virtual or otherwise) is required
5
+# to use this DevStack plugin.
6
+
7
+# Enable with:
8
+# DESIGNATE_BACKEND_DRIVER=infoblox
9
+
10
+# Dependencies:
11
+# ``functions`` file
12
+# ``designate`` configuration
13
+
14
+# install_designate_backend - install any external requirements
15
+# configure_designate_backend - make configuration changes, including those to other services
16
+# init_designate_backend - initialize databases, etc.
17
+# start_designate_backend - start any external services
18
+# stop_designate_backend - stop any external services
19
+# cleanup_designate_backend - remove transient data and cache
20
+
21
+# Save trace setting
22
+DP_INFOBLOX_XTRACE=$(set +o | grep xtrace)
23
+set +o xtrace
24
+
25
+# Defaults
26
+# --------
27
+
28
+DESIGNATE_INFOBLOX_USERNAME=${DESIGNATE_INFOBLOX_USERNAME:-admin}
29
+DESIGNATE_INFOBLOX_PASSWORD=${DESIGNATE_INFOBLOX_PASSWORD:-infoblox}
30
+DESIGNATE_INFOBLOX_NAMESERVER_IP=${DESIGNATE_INFOBLOX_NAMESERVER_IP:-172.16.98.200}
31
+DESIGNATE_INFOBLOX_API_IP=${DESIGNATE_INFOBLOX_API_IP:-$DESIGNATE_INFOBLOX_NAMESERVER_IP}
32
+DESIGNATE_INFOBLOX_WAPI_URL=${DESIGNATE_INFOBLOX_WAPI_URL:-https://$DESIGNATE_INFOBLOX_API_IP/wapi/v2.0/}
33
+DESIGNATE_INFOBLOX_SSLVERIFY=${DESIGNATE_INFOBLOX_SSLVERIFY:-False}
34
+DESIGNATE_INFOBLOX_MULTI_TENANT=${DESIGNATE_INFOBLOX_MULTI_TENANT:-False}
35
+DESIGNATE_INFOBLOX_HTTP_POOL_CONNECTIONS=${DESIGNATE_INFOBLOX_HTTP_POOL_CONNECTIONS:-100}
36
+DESIGNATE_INFOBLOX_HTTP_POOL_MAXSIZE=${DESIGNATE_INFOBLOX_HTTP_POOL_MAXSIZE:-100}
37
+DESIGNATE_INFOBLOX_DNS_VIEW=${DESIGNATE_INFOBLOX_DNS_VIEW:-default}
38
+DESIGNATE_INFOBLOX_NET_VIEW=${DESIGNATE_INFOBLOX_NET_VIEW:-default}
39
+DESIGNATE_INFOBLOX_NS_GROUP=${DESIGNATE_INFOBLOX_NS_GROUP:-Designate}
40
+
41
+# Entry Points
42
+# ------------
43
+
44
+
45
+# install_designate_backend - install any external requirements
46
+function install_designate_backend {
47
+    if is_ubuntu; then
48
+        install_package python-dev libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev
49
+    elif is_fedora; then
50
+        install_package python-devel libxslt1-devel libxslt1.1 libxml2-devel libxml2 libssl-devel
51
+    fi
52
+}
53
+
54
+# configure_designate_backend - make configuration changes, including those to other services
55
+function configure_designate_backend {
56
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type infoblox
57
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS
58
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "host: $DESIGNATE_INFOBLOX_NAMESERVER_IP, port: $DESIGNATE_SERVICE_PORT_DNS"
59
+
60
+    local nameserver_id=`uuidgen`
61
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers $nameserver_id
62
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $DESIGNATE_INFOBLOX_NAMESERVER_IP
63
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port $DESIGNATE_SERVICE_PORT_DNS
64
+
65
+    iniset $DESIGNATE_CONF backend:infoblox wapi_url $DESIGNATE_INFOBLOX_WAPI_URL
66
+    iniset $DESIGNATE_CONF backend:infoblox username $DESIGNATE_INFOBLOX_USERNAME
67
+    iniset $DESIGNATE_CONF backend:infoblox password $DESIGNATE_INFOBLOX_PASSWORD
68
+    iniset $DESIGNATE_CONF backend:infoblox sslverify $DESIGNATE_INFOBLOX_SSLVERIFY
69
+    iniset $DESIGNATE_CONF backend:infoblox multi_tenant $DESIGNATE_INFOBLOX_MULTI_TENANT
70
+    iniset $DESIGNATE_CONF backend:infoblox http_pool_connections $DESIGNATE_INFOBLOX_HTTP_POOL_CONNECTIONS
71
+    iniset $DESIGNATE_CONF backend:infoblox http_pool_maxsize $DESIGNATE_INFOBLOX_HTTP_POOL_MAXSIZE
72
+    iniset $DESIGNATE_CONF backend:infoblox dns_view $DESIGNATE_INFOBLOX_DNS_VIEW
73
+    iniset $DESIGNATE_CONF backend:infoblox net_view $DESIGNATE_INFOBLOX_NET_VIEW
74
+    iniset $DESIGNATE_CONF backend:infoblox ns_group $DESIGNATE_INFOBLOX_NS_GROUP
75
+}
76
+
77
+# init_designate_backend - initialize databases, etc.
78
+function init_designate_backend {
79
+    :
80
+}
81
+
82
+# start_designate_backend - start any external services
83
+function start_designate_backend {
84
+    :
85
+}
86
+
87
+# stop_designate_backend - stop any external services
88
+function stop_designate_backend {
89
+    :
90
+}
91
+
92
+# cleanup_designate_backend - remove transient data and cache
93
+function cleanup_designate_backend {
94
+    :
95
+}
96
+
97
+# Restore xtrace
98
+$DP_INFOBLOX_XTRACE

+ 77
- 0
devstack/designate_plugins/backend-ipa View File

@@ -0,0 +1,77 @@
1
+# Configure the ipa backend
2
+
3
+# Enable with:
4
+# DESIGNATE_BACKEND_DRIVER=ipa
5
+
6
+# Dependencies:
7
+# ``functions`` file
8
+# ``designate`` configuration
9
+
10
+# install_designate_backend - install any external requirements
11
+# configure_designate_backend - make configuration changes, including those to other services
12
+# init_designate_backend - initialize databases, etc.
13
+# start_designate_backend - start any external services
14
+# stop_designate_backend - stop any external services
15
+# cleanup_designate_backend - remove transient data and cache
16
+
17
+# Save trace setting
18
+DP_IPA_XTRACE=$(set +o | grep xtrace)
19
+set +o xtrace
20
+
21
+# Defaults
22
+# --------
23
+DESIGNATE_IPA_HOST=${DESIGNATE_IPA_HOST:-$(hostname)}
24
+DESIGNATE_IPA_CA_CERT=${DESIGNATE_IPA_CA_CERT:-/etc/ipa/ca.crt}
25
+DESIGNATE_IPA_CLIENT_KEYTAB=${DESIGNATE_IPA_CLIENT_KEYTAB:-$HOME/ipaadmin.keytab}
26
+
27
+# Entry Points
28
+# ------------
29
+
30
+# install_designate_backend - install any external requirements
31
+function install_designate_backend {
32
+    :
33
+}
34
+
35
+# configure_designate_backend - make configuration changes, including those to other services
36
+function configure_designate_backend {
37
+    rc=0
38
+    if [[ ! -f $DESIGNATE_IPA_CA_CERT ]]; then
39
+        echo ERROR: IPA CA cert file $DESIGNATE_IPA_CA_CERT not found
40
+        rc=1
41
+    fi
42
+    if [[ ! -f $DESIGNATE_IPA_CLIENT_KEYTAB ]]; then
43
+        echo ERROR: IPA client keytab file $DESIGNATE_IPA_CLIENT_KEYTAB not found
44
+        rc=1
45
+    fi
46
+    if [[ $rc = 1 ]]; then
47
+        die $LINENO "Error with IPA configuration"
48
+    fi
49
+    iniset $DESIGNATE_CONF backend:ipa ipa_host $DESIGNATE_IPA_HOST
50
+    iniset $DESIGNATE_CONF backend:ipa ipa_ca_cert $DESIGNATE_IPA_CA_CERT
51
+    iniset $DESIGNATE_CONF backend:ipa ipa_client_keytab $DESIGNATE_IPA_CLIENT_KEYTAB
52
+    # devstack tests use dummy NS records, so tell IPA to allow this
53
+    iniset $DESIGNATE_CONF backend:ipa ipa_force_ns_use True
54
+}
55
+
56
+# init_designate_backend - initialize databases, etc.
57
+function init_designate_backend {
58
+    :
59
+}
60
+
61
+# start_designate_backend - start any external services
62
+function start_designate_backend {
63
+    :
64
+}
65
+
66
+# stop_designate_backend - stop any external services
67
+function stop_designate_backend {
68
+    :
69
+}
70
+
71
+# cleanup_designate_backend - remove transient data and cache
72
+function cleanup_designate_backend {
73
+    :
74
+}
75
+
76
+# Restore xtrace
77
+$DP_IPA_XTRACE

+ 147
- 0
devstack/designate_plugins/backend-powerdns View File

@@ -0,0 +1,147 @@
1
+# Configure the powerdns backend
2
+
3
+# Enable with:
4
+# DESIGNATE_BACKEND_DRIVER=powerdns
5
+
6
+# Dependencies:
7
+# ``functions`` file
8
+# ``designate`` configuration
9
+
10
+# install_designate_backend - install any external requirements
11
+# configure_designate_backend - make configuration changes, including those to other services
12
+# init_designate_backend - initialize databases, etc.
13
+# start_designate_backend - start any external services
14
+# stop_designate_backend - stop any external services
15
+# cleanup_designate_backend - remove transient data and cache
16
+
17
+# Save trace setting
18
+DP_PDNS_XTRACE=$(set +o | grep xtrace)
19
+set +o xtrace
20
+
21
+# Defaults
22
+# --------
23
+if is_fedora; then
24
+    POWERDNS_CFG_DIR=/etc/pdns
25
+else
26
+    POWERDNS_CFG_DIR=/etc/powerdns
27
+fi
28
+
29
+# Entry Points
30
+# ------------
31
+
32
+# install_designate_backend - install any external requirements
33
+function install_designate_backend {
34
+    if is_ubuntu; then
35
+        PDNS=pdns-server
36
+    elif is_fedora || is_suse; then
37
+        PDNS=pdns
38
+    else
39
+        PDNS=pdns-server
40
+    fi
41
+
42
+    if is_service_enabled mysql; then
43
+        PDNS+=" pdns-backend-mysql"
44
+    elif is_service_enabled postgresql; then
45
+        PDNS+=" pdns-backend-pgsql"
46
+    else
47
+        die $LINENO "PowerDNS backend only supports MySQL / PostgreSQL"
48
+    fi
49
+
50
+    install_package $PDNS
51
+    sudo rm -rf $POWERDNS_CFG_DIR/pdns.d
52
+}
53
+
54
+# configure_designate_backend - make configuration changes, including those to other services
55
+function configure_designate_backend {
56
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID type powerdns
57
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID masters $DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_MDNS
58
+    iniset $DESIGNATE_CONF pool_target:$DESIGNATE_TARGET_ID options "connection: `database_connection_url designate_pdns`, host: $DESIGNATE_SERVICE_HOST, port: $DESIGNATE_SERVICE_PORT_DNS"
59
+
60
+    # DevStack Managed PDNS NameServer
61
+    local nameserver_id=`uuidgen`
62
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID nameservers $nameserver_id
63
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id host $DESIGNATE_SERVICE_HOST
64
+    iniset $DESIGNATE_CONF pool_nameserver:$nameserver_id port $DESIGNATE_SERVICE_PORT_DNS
65
+
66
+    sudo tee $POWERDNS_CFG_DIR/pdns.conf > /dev/null <<EOF
67
+# General Config
68
+setgid=pdns
69
+setuid=pdns
70
+config-dir=$POWERDNS_CFG_DIR
71
+socket-dir=/var/run
72
+guardian=yes
73
+daemon=yes
74
+disable-axfr=no
75
+local-address=$DESIGNATE_SERVICE_HOST
76
+local-port=$DESIGNATE_SERVICE_PORT_DNS
77
+master=no
78
+slave=yes
79
+cache-ttl=0
80
+query-cache-ttl=0
81
+negquery-cache-ttl=0
82
+out-of-zone-additional-processing=no
83
+EOF
84
+
85
+    if is_service_enabled mysql; then
86
+        sudo tee -a $POWERDNS_CFG_DIR/pdns.conf > /dev/null <<EOF
87
+# Launch gmysql backend
88
+launch=gmysql
89
+
90
+# gmysql parameters
91
+gmysql-host=$DATABASE_HOST
92
+gmysql-user=$DATABASE_USER
93
+gmysql-password=$DATABASE_PASSWORD
94
+gmysql-dbname=designate_pdns
95
+gmysql-dnssec=yes
96
+EOF
97
+    elif is_service_enabled postgresql; then
98
+        sudo tee -a $POWERDNS_CFG_DIR/pdns.conf > /dev/null <<EOF
99
+# Launch gpgsql backend
100
+launch=gpgsql
101
+
102
+# gmysql parameters
103
+gpgsql-host=$DATABASE_HOST
104
+gpgsql-user=$DATABASE_USER
105
+gpgsql-password=$DATABASE_PASSWORD
106
+gpgsql-dbname=designate_pdns
107
+gpgsql-dnssec=yes
108
+EOF
109
+    else
110
+        die $LINENO "PowerDNS backend only supports MySQL / PostgreSQL"
111
+    fi
112
+
113
+    restart_service pdns
114
+}
115
+
116
+# init_designate_backend - initialize databases, etc.
117
+function init_designate_backend {
118
+    # Stop pdns so that the migration succeeds, if not you get a error
119
+    # that the schema is still in use.
120
+    if is_service_enabled postgresql; then
121
+        stop_designate_backend
122
+    fi
123
+
124
+    # (Re)create designate_pdns database
125
+    recreate_database designate_pdns utf8
126
+
127
+    # Init and migrate designate_pdns database
128
+    designate-manage powerdns sync $DESIGNATE_TARGET_ID
129
+}
130
+
131
+# start_designate_backend - start any external services
132
+function start_designate_backend {
133
+    start_service pdns
134
+}
135
+
136
+# stop_designate_backend - stop any external services
137
+function stop_designate_backend {
138
+    stop_service pdns
139
+}
140
+
141
+# cleanup_designate_backend - remove transient data and cache
142
+function cleanup_designate_backend {
143
+    :
144
+}
145
+
146
+# Restore xtrace
147
+$DP_PDNS_XTRACE

+ 318
- 0
devstack/exercise.sh View File

@@ -0,0 +1,318 @@
1
+#!/usr/bin/env bash
2
+
3
+# **designate.sh**
4
+
5
+# Simple Tests to verify designate is running
6
+
7
+echo "*********************************************************************"
8
+echo "Begin DevStack Exercise: $0"
9
+echo "*********************************************************************"
10
+
11
+# This script exits on an error so that errors don't compound and you see
12
+# only the first error that occurred.
13
+set -o errexit
14
+
15
+# Print the commands being run so that we can see the command that triggers
16
+# an error.  It is also useful for following allowing as the install occurs.
17
+set -o xtrace
18
+
19
+
20
+# Keep track of the current directory
21
+SCRIPT_DIR=$(cd $(dirname "$0") && pwd)
22
+
23
+DEVSTACK_DIR=$(cd $SCRIPT_DIR/../..; pwd)/devstack
24
+if [ -x "$HOME/devstack/stack.sh" ]; then
25
+  DEVSTACK_DIR=$HOME/devstack/
26
+fi
27
+
28
+# Import common functions
29
+source $DEVSTACK_DIR/functions
30
+
31
+# Import configuration
32
+source $DEVSTACK_DIR/openrc admin admin
33
+
34
+# Import exercise configuration
35
+source $DEVSTACK_DIR/exerciserc
36
+
37
+# Skip if designate is not enabled
38
+is_service_enabled designate || exit 55
39
+
40
+# Import settings + designate library
41
+source $SCRIPT_DIR/plugin.sh
42
+
43
+# Settings
44
+# ========
45
+source $SCRIPT_DIR/settings
46
+
47
+# Used with dig to look up in DNS
48
+DIG_TIMEOUT=30
49
+
50
+if [ "$DESIGNATE_BACKEND_DRIVER" == "akamai" ]; then
51
+    # Akamai can be slow to propagate changes out
52
+    DIG_TIMEOUT=300
53
+fi
54
+
55
+# used with dig to look up in DNS
56
+DIG_FLAGS="-p $DESIGNATE_SERVICE_PORT_DNS @$DESIGNATE_SERVICE_HOST"
57
+
58
+# used with dig to do an AXFR against MDNS
59
+DIG_AXFR_FLAGS="-p $DESIGNATE_SERVICE_PORT_MDNS @$DESIGNATE_SERVICE_HOST AXFR +tcp +nocmd"
60
+
61
+# Functions
62
+# =========
63
+
64
+function cleanup {
65
+    # Try to cleanup any domains, this is important for backends like
66
+    # Akamai/Dyn, where state is not fully reset between test runs.
67
+    source $DEVSTACK_DIR/openrc admin admin
68
+
69
+    designate --all-tenants domain-list -f csv | awk 'BEGIN { FS = "," } ; {print $1}' | \
70
+        tail -n+2 | xargs --no-run-if-empty -n1 designate --all-tenants domain-delete
71
+}
72
+trap cleanup EXIT
73
+
74
+function ensure_record_present {
75
+    local record_name=$1
76
+    local record_type=$2
77
+    local record_value=$3
78
+
79
+    if [ "$DESIGNATE_BACKEND_DRIVER" = "fake" ] ; then
80
+        # if the backend is fake, there will be no actual DNS records
81
+        return 0
82
+    fi
83
+
84
+    if ! timeout $DIG_TIMEOUT sh -c "while ! dig +short $DIG_FLAGS $record_name $record_type | grep \"$record_value\"; do sleep 1; done"; then
85
+        die $LINENO "Error: record $record_name ($record_type) not found in DNS"
86
+    fi
87
+
88
+    # Display for debugging
89
+    dig $DIG_FLAGS $record_name $record_type
90
+
91
+    return 0
92
+}
93
+
94
+function ensure_record_absent {
95
+    local record_name=$1
96
+    local record_type=$2
97
+    local record_value=$3
98
+
99
+    if [ "$DESIGNATE_BACKEND_DRIVER" = "fake" ] ; then
100
+        # if the backend is fake, there will be no actual DNS records
101
+        return 0
102
+    fi
103
+
104
+    if ! timeout $DIG_TIMEOUT sh -c "while dig +short $DIG_FLAGS $record_name $record_type | grep \"$record_value\"; do sleep 1; done"; then
105
+        # Display for debugging
106
+        dig $DIG_FLAGS $record_name $record_type
107
+
108
+        die $LINENO "Error: record $record_name ($record_type) found in DNS, should be absent"
109
+    fi
110
+
111
+    return 0
112
+}
113
+
114
+# do an AXFR request to MDNS
115
+# if it does not match the expected value, give an error
116
+function verify_axfr_in_mdns {
117
+    # Display for debugging
118
+    dig $DIG_AXFR_FLAGS "$1"
119
+    if dig $DIG_AXFR_FLAGS "$1"; then
120
+        if [ -n "$2" ] ; then
121
+            local axfr_records=$(dig $DIG_AXFR_FLAGS "$1" | grep "$1" | wc -l)
122
+            if [ "$axfr_records" = "$2" ] ; then
123
+                return 0
124
+            else
125
+                die $LINENO "Error: AXFR to MDNS did not return the expected number of records"
126
+            fi
127
+        fi
128
+        return 0
129
+    else
130
+        die $LINENO "Error: AXFR to MDNS did not return a correct response"
131
+    fi
132
+}
133
+
134
+# get the domain id (uuid) given the domain name
135
+# if REQUIRED is set, die with an error if name not found
136
+function get_domain_id {
137
+    local domain_name=$1
138
+    local required=$2
139
+    local domain_id=$(designate domain-list | egrep " $domain_name " | get_field 1)
140
+    if [ "$required" = "1" ] ; then
141
+        die_if_not_set $LINENO domain_id "Failure retrieving DOMAIN_ID"
142
+    fi
143
+    echo "$domain_id"
144
+}
145
+
146
+
147
+# get the domain_name given the id
148
+function get_domain_name {
149
+    designate domain-list | grep "$1" | get_field 2
150
+}
151
+
152
+# if the given domain does not exist, it will be created
153
+# the domain_id of the domain will be returned
154
+function get_or_create_domain_id {
155
+    local domainid=$(get_domain_id "$1")
156
+    if [[ -z "$domainid" ]]; then
157
+        designate domain-create --name $1 --email admin@devstack.org --ttl 86400 --description "domain $1" 1>&2
158
+        domainid=$(designate domain-list | grep "$1" | get_field 1)
159
+    fi
160
+    echo $domainid
161
+}
162
+
163
+# get the record id (uuid) given the record name and domain id
164
+# if REQUIRED is set, die with an error if name not found
165
+function get_record_id {
166
+    local domain_id=$1
167
+    local record_name=$2
168
+    local record_type=$3
169
+    local required=$4
170
+    local record_id=$(designate record-list $domain_id | egrep " $record_name " | egrep " $record_type " | get_field 1)
171
+    if [ "$required" = "1" ] ; then
172
+        die_if_not_set $LINENO record_id "Failure retrieving RECORD_ID"
173
+    fi
174
+    echo "$record_id"
175
+}
176
+
177
+# Testing Servers
178
+# ===============
179
+designate server-list
180
+
181
+# NUMBER_OF_RECORDS keeps track of the records we need to get for AXFR
182
+# We start with the number of NS lines returned from server list
183
+# (Header line makes up for SOA + Number of NS record lines)
184
+NUMBER_OF_RECORDS=$(designate server-list -f csv | wc -l)
185
+
186
+# Add 1 extra to account for the additional SOA at the end of the AXFR
187
+((NUMBER_OF_RECORDS+=1))
188
+
189
+# Testing Domains
190
+# ===============
191
+
192
+# List domains
193
+designate domain-list
194
+
195
+# Create random domain name
196
+DOMAIN_NAME="exercise-$(openssl rand -hex 4).com."
197
+
198
+# Create the domain
199
+designate domain-create --name $DOMAIN_NAME --email devstack@example.org
200
+
201
+DOMAIN_ID=$(get_domain_id $DOMAIN_NAME 1)
202
+
203
+# Fetch the domain
204
+designate domain-get $DOMAIN_ID
205
+
206
+# List the nameservers hosting the domain
207
+designate domain-servers-list $DOMAIN_ID
208
+
209
+# Testing Records
210
+# ===============
211
+
212
+# Create random record name
213
+A_RECORD_NAME="$(openssl rand -hex 4).${DOMAIN_NAME}"
214
+
215
+# Create an A record
216
+designate record-create $DOMAIN_ID --name $A_RECORD_NAME --type A --data 127.0.0.1
217
+((NUMBER_OF_RECORDS++))
218
+A_RECORD_ID=$(get_record_id $DOMAIN_ID $A_RECORD_NAME A)
219
+
220
+# Fetch the record
221
+designate record-get $DOMAIN_ID $A_RECORD_ID
222
+
223
+# Verify the record is published in DNS
224
+ensure_record_present $A_RECORD_NAME A 127.0.0.1
225
+
226
+# -----
227
+
228
+# Create random record name
229
+AAAA_RECORD_NAME="$(openssl rand -hex 4).${DOMAIN_NAME}"
230
+
231
+# Create an AAAA record
232
+designate record-create $DOMAIN_ID --name $AAAA_RECORD_NAME --type AAAA --data "2607:f0d0:1002:51::4"
233
+((NUMBER_OF_RECORDS++))
234
+AAAA_RECORD_ID=$(get_record_id $DOMAIN_ID $AAAA_RECORD_NAME AAAA)
235
+
236
+# Fetch the record
237
+designate record-get $DOMAIN_ID $AAAA_RECORD_ID
238
+
239
+# Verify the record is published in DNS
240
+ensure_record_present $AAAA_RECORD_NAME AAAA 2607:f0d0:1002:51::4
241
+
242
+# -----
243
+
244
+# Create a MX record
245
+designate record-create $DOMAIN_ID --name $DOMAIN_NAME --type MX --priority 5 --data "mail.example.com."
246
+((NUMBER_OF_RECORDS++))
247
+MX_RECORD_ID=$(get_record_id $DOMAIN_ID $DOMAIN_NAME MX)
248
+
249
+# Fetch the record
250
+designate record-get $DOMAIN_ID $MX_RECORD_ID
251
+
252
+# Verify the record is published in DNS
253
+ensure_record_present $DOMAIN_NAME MX "5 mail.example.com."
254
+
255
+# -----
256
+
257
+# Create a SRV record
258
+designate record-create $DOMAIN_ID --name _sip._tcp.$DOMAIN_NAME --type SRV --priority 10 --data "5 5060 sip.example.com."
259
+((NUMBER_OF_RECORDS++))
260
+SRV_RECORD_ID=$(get_record_id $DOMAIN_ID _sip._tcp.$DOMAIN_NAME SRV)
261
+
262
+# Fetch the record
263
+designate record-get $DOMAIN_ID $SRV_RECORD_ID
264
+
265
+# Verify the record is published in DNS
266
+ensure_record_present _sip._tcp.$DOMAIN_NAME SRV "10 5 5060 sip.example.com."
267
+
268
+# -----
269
+
270
+# Create random record name
271
+CNAME_RECORD_NAME="$(openssl rand -hex 4).${DOMAIN_NAME}"
272
+
273
+# Create a CNAME record
274
+designate record-create $DOMAIN_ID --name $CNAME_RECORD_NAME --type CNAME --data $DOMAIN_NAME
275
+((NUMBER_OF_RECORDS++))
276
+CNAME_RECORD_ID=$(get_record_id $DOMAIN_ID $CNAME_RECORD_NAME CNAME)
277
+
278
+# Fetch the record
279
+designate record-get $DOMAIN_ID $CNAME_RECORD_ID
280
+
281
+# Verify the record is published in DNS
282
+ensure_record_present $CNAME_RECORD_NAME CNAME $DOMAIN_NAME
283
+
284
+# -----
285
+
286
+# List Records
287
+designate record-list $DOMAIN_ID
288
+
289
+# Send an AXFR to MDNS and check for the records returned
290
+verify_axfr_in_mdns $DOMAIN_NAME $NUMBER_OF_RECORDS
291
+
292
+# -----
293
+
294
+# Delete a Record
295
+designate record-delete $DOMAIN_ID $CNAME_RECORD_ID
296
+
297
+# List Records
298
+designate record-list $DOMAIN_ID
299
+
300
+# Fetch the record - should be gone
301
+designate record-get $DOMAIN_ID $CNAME_RECORD_ID || echo "good - record was removed"
302
+
303
+# verify not in DNS anymore
304
+ensure_record_absent $CNAME_RECORD_NAME CNAME $DOMAIN_NAME
305
+
306
+# Testing Domains Delete
307
+# ======================
308
+
309
+# Delete the domain
310
+designate domain-delete $DOMAIN_ID
311
+
312
+# Fetch the domain - should be gone
313
+designate domain-get $DOMAIN_ID || echo "good - domain was removed"
314
+
315
+set +o xtrace
316
+echo "*********************************************************************"
317
+echo "SUCCESS: End DevStack Exercise: $0"
318
+echo "*********************************************************************"

+ 24
- 0
devstack/gate/gate_hook.sh View File

@@ -0,0 +1,24 @@
1
+#!/bin/bash
2
+
3
+set -ex
4
+
5
+pushd $BASE/new/devstack
6
+
7
+DEVSTACK_GATE_DESIGNATE_DRIVER=${DEVSTACK_GATE_DESIGNATE_DRIVER:-powerdns}
8
+
9
+export KEEP_LOCALRC=1
10
+export ENABLED_SERVICES=designate,designate-api,designate-central,designate-sink,designate-mdns,designate-pool-manager,designate-zone-manager
11
+
12
+echo "DESIGNATE_SERVICE_PORT_DNS=5322" >> $BASE/new/devstack/localrc
13
+echo "DESIGNATE_BACKEND_DRIVER=$DEVSTACK_GATE_DESIGNATE_DRIVER" >> $BASE/new/devstack/localrc
14
+echo "DESIGNATE_PERIODIC_RECOVERY_INTERVAL=20" >> $BASE/new/devstack/localrc
15
+echo "DESIGNATE_PERIODIC_SYNC_INTERVAL=20" >> $BASE/new/devstack/localrc
16
+
17
+
18
+# Pass through any DESIGNATE_ env vars to the localrc file
19
+env | grep -E "^DESIGNATE_" >> $BASE/new/devstack/localrc || :
20
+
21
+popd
22
+
23
+# Run DevStack Gate
24
+$BASE/new/devstack-gate/devstack-vm-gate.sh

+ 9
- 0
devstack/gate/post_test_hook.sh View File

@@ -0,0 +1,9 @@
1
+#!/bin/bash
2
+
3
+set -ex
4
+
5
+# Run the Designate DevStack exercises
6
+$BASE/new/designate/devstack/exercise.sh
7
+
8
+# Run the Designate Tempest tests
9
+sudo ./run_tempest_tests.sh

+ 32
- 0
devstack/gate/run_tempest_tests.sh View File

@@ -0,0 +1,32 @@
1
+#!/bin/bash -e
2
+#
3
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+# not use this file except in compliance with the License. You may obtain
5
+# a copy of the License at
6
+#
7
+#      http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+# Unless required by applicable law or agreed to in writing, software
10
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+# License for the specific language governing permissions and limitations
13
+# under the License.
14
+
15
+# How many seconds to wait for the API to be responding before giving up
16
+API_RESPONDING_TIMEOUT=20
17
+
18
+if ! timeout ${API_RESPONDING_TIMEOUT} sh -c "while ! curl -s http://127.0.0.1:9001/ 2>/dev/null | grep -q 'v1' ; do sleep 1; done"; then
19
+    echo "The Designate API failed to respond within ${API_RESPONDING_TIMEOUT} seconds"
20
+    exit 1
21
+fi
22
+
23
+echo "Successfully contacted the Designate API"
24
+
25
+# Where Designate and Tempest code lives
26
+DESIGNATE_DIR=${DESIGNATE_DIR:-/opt/stack/new/designate}
27
+TEMPEST_DIR=${TEMPEST_DIR:-/opt/stack/new/tempest}
28
+
29
+
30
+pushd $DESIGNATE_DIR
31
+export TEMPEST_CONFIG=$TEMPEST_DIR/etc/tempest.conf
32
+tox -e functional

+ 342
- 0
devstack/plugin.sh View File

@@ -0,0 +1,342 @@
1
+# Install and start **Designate** service in Devstack
2
+
3
+# Save trace setting
4
+XTRACE=$(set +o | grep xtrace)
5
+set +o xtrace
6
+
7
+# Get backend configuration
8
+# ----------------------------
9
+if is_service_enabled designate && [[ -r $DESIGNATE_PLUGINS/backend-$DESIGNATE_BACKEND_DRIVER ]]; then
10
+    # Load plugin
11
+    source $DESIGNATE_PLUGINS/backend-$DESIGNATE_BACKEND_DRIVER
12
+fi
13
+
14
+# Helper Functions
15
+# ----------------
16
+function setup_colorized_logging_designate {
17
+    local conf_file=$1
18
+    local conf_section=$2
19
+    local project_var=${3:-"project_name"}
20
+    local user_var=${4:-"user_name"}
21
+
22
+    setup_colorized_logging $conf_file $conf_section $project_var $user_var
23
+
24
+    # Override the logging_context_format_string value chosen by
25
+    # setup_colorized_logging.
26
+    iniset $conf_file $conf_section logging_context_format_string "%(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_identity)s%(color)s] %(instance)s%(color)s%(message)s"
27
+}
28
+
29
+# DevStack Plugin
30
+# ---------------
31
+
32
+# cleanup_designate - Remove residual data files, anything left over from previous
33
+# runs that a clean run would need to clean up
34
+function cleanup_designate {
35
+    sudo rm -rf $DESIGNATE_STATE_PATH $DESIGNATE_AUTH_CACHE_DIR
36
+    cleanup_designate_backend
37
+}
38
+
39
+# configure_designate - Set config files, create data dirs, etc
40
+function configure_designate {
41
+    [ ! -d $DESIGNATE_CONF_DIR ] && sudo mkdir -m 755 -p $DESIGNATE_CONF_DIR
42
+    sudo chown $STACK_USER $DESIGNATE_CONF_DIR
43
+
44
+    [ ! -d $DESIGNATE_LOG_DIR ] &&  sudo mkdir -m 755 -p $DESIGNATE_LOG_DIR
45
+    sudo chown $STACK_USER $DESIGNATE_LOG_DIR
46
+
47
+    # (Re)create ``designate.conf``
48
+    rm -f $DESIGNATE_CONF
49
+
50
+    # General Configuration
51
+    iniset_rpc_backend designate $DESIGNATE_CONF DEFAULT
52
+
53
+    iniset $DESIGNATE_CONF DEFAULT debug $ENABLE_DEBUG_LOG_LEVEL
54
+    iniset $DESIGNATE_CONF DEFAULT verbose True
55
+    iniset $DESIGNATE_CONF DEFAULT state_path $DESIGNATE_STATE_PATH
56
+    iniset $DESIGNATE_CONF DEFAULT root-helper sudo designate-rootwrap $DESIGNATE_ROOTWRAP_CONF
57
+    iniset $DESIGNATE_CONF storage:sqlalchemy connection `database_connection_url designate`
58
+
59
+    # Coordination Configuration
60
+    if [[ -n "$DESIGNATE_COORDINATION_URL" ]]; then
61
+        iniset $DESIGNATE_CONF coordination backend_url $DESIGNATE_COORDINATION_URL
62
+    fi
63
+
64
+    # Install the policy file for the API server
65
+    cp $DESIGNATE_DIR/etc/designate/policy.json $DESIGNATE_CONF_DIR/policy.json
66
+    iniset $DESIGNATE_CONF DEFAULT policy_file $DESIGNATE_CONF_DIR/policy.json
67
+
68
+    # Pool Manager Configuration
69
+    iniset $DESIGNATE_CONF service:pool_manager pool_id $DESIGNATE_POOL_ID
70
+    iniset $DESIGNATE_CONF service:pool_manager cache_driver $DESIGNATE_POOL_MANAGER_CACHE_DRIVER
71
+    iniset $DESIGNATE_CONF service:pool_manager periodic_recovery_interval $DESIGNATE_PERIODIC_RECOVERY_INTERVAL
72
+    iniset $DESIGNATE_CONF service:pool_manager periodic_sync_interval $DESIGNATE_PERIODIC_SYNC_INTERVAL
73
+
74
+    # Pool Manager Cache
75
+    if [ "$DESIGNATE_POOL_MANAGER_CACHE_DRIVER" == "sqlalchemy" ]; then
76
+        iniset $DESIGNATE_CONF pool_manager_cache:sqlalchemy connection `database_connection_url designate_pool_manager`
77
+    fi
78
+
79
+    # Pool Options
80
+    iniset $DESIGNATE_CONF pool:$DESIGNATE_POOL_ID targets $DESIGNATE_TARGET_ID
81
+
82
+    # API Configuration
83
+    sudo cp $DESIGNATE_DIR/etc/designate/api-paste.ini $DESIGNATE_APIPASTE_CONF
84
+    iniset $DESIGNATE_CONF service:api enabled_extensions_v1 $DESIGNATE_ENABLED_EXTENSIONS_V1
85
+    iniset $DESIGNATE_CONF service:api enabled_extensions_v2 $DESIGNATE_ENABLED_EXTENSIONS_V2
86
+    iniset $DESIGNATE_CONF service:api enabled_extensions_admin $DESIGNATE_ENABLED_EXTENSIONS_ADMIN
87
+    iniset $DESIGNATE_CONF service:api api_host $DESIGNATE_SERVICE_HOST
88
+    iniset $DESIGNATE_CONF service:api api_base_uri $DESIGNATE_SERVICE_PROTOCOL://$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT/
89
+    iniset $DESIGNATE_CONF service:api enable_api_v1 True
90
+    iniset $DESIGNATE_CONF service:api enable_api_v2 True
91
+    iniset $DESIGNATE_CONF service:api enable_api_admin True
92
+
93
+    # mDNS Configuration
94
+    iniset $DESIGNATE_CONF service:mdns host $DESIGNATE_SERVICE_HOST
95
+    iniset $DESIGNATE_CONF service:mdns port $DESIGNATE_SERVICE_PORT_MDNS
96
+
97
+    # Set up Notifications/Ceilometer Integration
98
+    iniset $DESIGNATE_CONF DEFAULT notification_driver "$DESIGNATE_NOTIFICATION_DRIVER"
99
+    iniset $DESIGNATE_CONF DEFAULT notification_topics "$DESIGNATE_NOTIFICATION_TOPICS"
100
+
101
+    # Root Wrap
102
+    sudo cp $DESIGNATE_DIR/etc/designate/rootwrap.conf.sample $DESIGNATE_ROOTWRAP_CONF
103
+    iniset $DESIGNATE_ROOTWRAP_CONF DEFAULT filters_path $DESIGNATE_DIR/etc/designate/rootwrap.d root-helper
104
+
105
+    # Oslo Concurrency
106
+    iniset $DESIGNATE_CONF oslo_concurrency lock_path "$DESIGNATE_STATE_PATH"
107
+
108
+    # Set up the rootwrap sudoers for designate
109
+    local rootwrap_sudoer_cmd="$DESIGNATE_BIN_DIR/designate-rootwrap $DESIGNATE_ROOTWRAP_CONF *"
110
+    local tempfile=`mktemp`
111
+    echo "$STACK_USER ALL=(root) NOPASSWD: $rootwrap_sudoer_cmd" >$tempfile
112
+    chmod 0440 $tempfile
113
+    sudo chown root:root $tempfile
114
+    sudo mv $tempfile /etc/sudoers.d/designate-rootwrap
115
+
116
+    # TLS Proxy Configuration
117
+    if is_service_enabled tls-proxy; then
118
+        # Set the service port for a proxy to take the original
119
+        iniset $DESIGNATE_CONF service:api api_port $DESIGNATE_SERVICE_PORT_INT
120
+    else
121
+        iniset $DESIGNATE_CONF service:api api_port $DESIGNATE_SERVICE_PORT
122
+    fi
123
+
124
+    # Setup the Keystone Integration
125
+    if is_service_enabled key; then
126
+        iniset $DESIGNATE_CONF service:api auth_strategy keystone
127
+        configure_auth_token_middleware $DESIGNATE_CONF designate $DESIGNATE_AUTH_CACHE_DIR
128
+    fi
129
+
130
+    # Logging Configuration
131
+    if [ "$SYSLOG" != "False" ]; then
132
+        iniset $DESIGNATE_CONF DEFAULT use_syslog True
133
+    fi
134
+
135
+    # Format logging
136
+    if [ "$LOG_COLOR" == "True" ] && [ "$SYSLOG" == "False" ]; then
137
+        setup_colorized_logging_designate $DESIGNATE_CONF DEFAULT "tenant" "user"
138
+    fi
139
+
140
+    # Backend Plugin Configuation
141
+    configure_designate_backend
142
+}
143
+
144
+# Configure the needed tempest options
145
+function configure_designate_tempest() {
146
+    if is_service_enabled tempest; then
147
+        nameservers=$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_DNS
148
+        case $DESIGNATE_BACKEND_DRIVER in
149
+            bind9|powerdns)
150
+                nameservers="$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT_DNS"
151
+                ;;
152
+            akamai)
153
+                nameservers="$DESIGNATE_AKAMAI_NAMESERVERS"
154
+                ;;
155
+            dynect)
156
+                nameservers="$DESIGNATE_DYNECT_NAMESERVERS"
157
+                ;;
158
+        esac
159
+
160
+        if [ ! -z "$DESIGNATE_NAMESERVERS" ]; then
161
+            nameservers=$DESIGNATE_NAMESERVERS
162
+        fi
163
+
164
+        iniset $TEMPEST_CONFIG designate nameservers $nameservers
165
+    fi
166
+}
167
+
168
+# create_designate_accounts - Set up common required designate accounts
169
+
170
+# Tenant               User       Roles
171
+# ------------------------------------------------------------------
172
+# service              designate  admin        # if enabled
173
+function create_designate_accounts {
174
+    if is_service_enabled designate-api; then
175
+        create_service_user "designate"
176
+
177
+        if [[ "$KEYSTONE_CATALOG_BACKEND" = 'sql' ]]; then
178
+            get_or_create_service "designate" "dns" "Designate DNS Service"
179
+            get_or_create_endpoint "dns" \
180
+                "$REGION_NAME" \
181
+                "$DESIGNATE_SERVICE_PROTOCOL://$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT/" \
182
+                "$DESIGNATE_SERVICE_PROTOCOL://$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT/" \
183
+                "$DESIGNATE_SERVICE_PROTOCOL://$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT/"
184
+        fi
185
+    fi
186
+}
187
+
188
+# create_designate_ns_records - Create Pool NS Records
189
+function create_designate_ns_records {
190
+    # Allow Backends to install their own NS Records rather than the default
191
+    if function_exists create_designate_ns_records_backend; then
192
+        create_designate_ns_records_backend
193
+    else
194
+        designate server-create --name $DESIGNATE_DEFAULT_NS_RECORD
195
+    fi
196
+}
197
+
198
+# init_designate - Initialize etc.
199
+function init_designate {
200
+    # Create cache dir
201
+    sudo mkdir -p $DESIGNATE_AUTH_CACHE_DIR
202
+    sudo chown $STACK_USER $DESIGNATE_AUTH_CACHE_DIR
203
+    rm -f $DESIGNATE_AUTH_CACHE_DIR/*
204
+
205
+    # Some Designate Backends require mdns be bound to port 53, make that
206
+    # doable.
207
+    sudo setcap 'cap_net_bind_service=+ep' $(readlink -f /usr/bin/python)
208
+
209
+    # (Re)create designate database
210
+    recreate_database designate utf8
211
+
212
+    # Init and migrate designate database
213
+    designate-manage database sync
214
+
215
+    if [ "$DESIGNATE_POOL_MANAGER_CACHE_DRIVER" == "sqlalchemy" ]; then
216
+        # (Re)create designate_pool_manager cache
217
+        recreate_database designate_pool_manager utf8
218
+
219
+        # Init and migrate designate pool-manager-cache
220
+        designate-manage pool-manager-cache sync
221
+    fi
222
+
223
+    init_designate_backend
224
+}
225
+
226
+# install_designate - Collect source and prepare
227
+function install_designate {
228
+    if is_fedora; then
229
+        # This package provides `dig`
230
+        install_package bind-utils
231
+    fi
232
+
233
+    git_clone $DESIGNATE_REPO $DESIGNATE_DIR $DESIGNATE_BRANCH
234
+    setup_develop $DESIGNATE_DIR
235
+
236
+    install_designate_backend
237
+}
238
+
239
+# install_designateclient - Collect source and prepare
240
+function install_designateclient {
241
+    if use_library_from_git "python-designateclient"; then
242
+        git_clone_by_name "python-designateclient"
243
+        setup_dev_lib "python-designateclient"
244
+    else
245
+        pip_install_gr "python-designateclient"
246
+    fi
247
+}
248
+
249
+# install_designatedashboard - Collect source and prepare
250
+function install_designatedashboard {
251
+    git_clone $DESIGNATEDASHBOARD_REPO $DESIGNATEDASHBOARD_DIR $DESIGNATEDASHBOARD_BRANCH
252
+    setup_develop $DESIGNATEDASHBOARD_DIR
253
+    ln -fs $DESIGNATEDASHBOARD_DIR/designatedashboard/enabled/_70_dns_add_group.py $HORIZON_DIR/openstack_dashboard/local/enabled/70_dns_add_group.py
254
+    ln -fs $DESIGNATEDASHBOARD_DIR/designatedashboard/enabled/_71_dns_project.py $HORIZON_DIR/openstack_dashboard/local/enabled/71_dns_project.py
255
+}
256
+
257
+# start_designate - Start running processes, including screen
258
+function start_designate {
259
+    start_designate_backend
260
+
261
+    run_process designate-central "$DESIGNATE_BIN_DIR/designate-central --config-file $DESIGNATE_CONF"
262
+    run_process designate-api "$DESIGNATE_BIN_DIR/designate-api --config-file $DESIGNATE_CONF"
263
+    run_process designate-pool-manager "$DESIGNATE_BIN_DIR/designate-pool-manager --config-file $DESIGNATE_CONF"
264
+    run_process designate-zone-manager "$DESIGNATE_BIN_DIR/designate-zone-manager --config-file $DESIGNATE_CONF"
265
+    run_process designate-mdns "$DESIGNATE_BIN_DIR/designate-mdns --config-file $DESIGNATE_CONF"
266
+    run_process designate-agent "$DESIGNATE_BIN_DIR/designate-agent --config-file $DESIGNATE_CONF"
267
+    run_process designate-sink "$DESIGNATE_BIN_DIR/designate-sink --config-file $DESIGNATE_CONF"
268
+
269
+    # Start proxies if enabled
270
+    if is_service_enabled designate-api && is_service_enabled tls-proxy; then
271
+        start_tls_proxy '*' $DESIGNATE_SERVICE_PORT $DESIGNATE_SERVICE_HOST $DESIGNATE_SERVICE_PORT_INT &
272
+    fi
273
+
274
+    if ! timeout $SERVICE_TIMEOUT sh -c "while ! wget --no-proxy -q -O- $DESIGNATE_SERVICE_PROTOCOL://$DESIGNATE_SERVICE_HOST:$DESIGNATE_SERVICE_PORT; do sleep 1; done"; then
275
+        die $LINENO "Designate did not start"
276
+    fi
277
+}
278
+
279
+# stop_designate - Stop running processes
280
+function stop_designate {
281
+    # Kill the designate screen windows
282
+    stop_process designate-central
283
+    stop_process designate-api
284
+    stop_process designate-pool-manager
285
+    stop_process designate-zone-manager
286
+    stop_process designate-mdns
287
+    stop_process designate-agent
288
+    stop_process designate-sink
289
+
290
+    stop_designate_backend
291
+}
292
+
293
+# This is the main for plugin.sh
294
+if is_service_enabled designate; then
295
+
296
+    if [[ "$1" == "stack" && "$2" == "install" ]]; then
297
+        echo_summary "Installing Designate"
298
+        install_designate
299
+
300
+        echo_summary "Installing Designate client"
301
+        install_designateclient
302
+
303
+        if is_service_enabled horizon; then
304
+            echo_summary "Installing Designate dashboard"
305
+            install_designatedashboard
306
+        fi
307
+
308
+    elif [[ "$1" == "stack" && "$2" == "post-config" ]]; then
309
+        echo_summary "Configuring Designate"
310
+        configure_designate
311
+
312
+        if is_service_enabled key; then
313
+            echo_summary "Creating Designate Keystone accounts"
314
+            create_designate_accounts
315
+        fi
316
+
317
+    elif [[ "$1" == "stack" && "$2" == "extra" ]]; then
318
+        echo_summary "Initializing Designate"
319
+        init_designate
320
+
321
+        echo "Configuring Tempest options for Designate"
322
+        configure_designate_tempest
323
+
324
+        echo_summary "Starting Designate"
325
+        start_designate
326
+
327
+        echo_summary "Creating pool NS records"
328
+        create_designate_ns_records
329
+    fi
330
+
331
+    if [[ "$1" == "unstack" ]]; then
332
+        stop_designate
333
+    fi
334
+
335
+    if [[ "$1" == "clean" ]]; then
336
+        echo_summary "Cleaning Designate"
337
+        cleanup_designate
338
+    fi
339
+fi
340
+
341
+# Restore xtrace
342
+$XTRACE

+ 58
- 0
devstack/settings View File

@@ -0,0 +1,58 @@
1
+# Default options
2
+DESIGNATE_BACKEND_DRIVER=${DESIGNATE_BACKEND_DRIVER:=powerdns}
3
+DESIGNATE_POOL_MANAGER_CACHE_DRIVER=${DESIGNATE_POOL_MANAGER_CACHE_DRIVER:-memcache}
4
+DESIGNATE_POOL_ID=${DESIGNATE_POOL_ID:-794ccc2c-d751-44fe-b57f-8894c9f5c842}
5
+DESIGNATE_TARGET_ID=${DESIGNATE_TARGET_ID:-f26e0b32-736f-4f0a-831b-039a415c481e}
6
+DESIGNATE_DEFAULT_NS_RECORD=${DESIGNATE_DEFAULT_NS_RECORD:-ns1.devstack.org.}
7
+DESIGNATE_NOTIFICATION_DRIVER=${DESIGNATE_NOTIFICATION_DRIVER:-}
8
+DESIGNATE_NOTIFICATION_TOPICS=${DESIGNATE_NOTIFICATION_TOPICS:-notifications}
9
+DESIGNATE_PERIODIC_RECOVERY_INTERVAL=${DESIGNATE_PERIODIC_RECOVERY_INTERVAL:-120}
10
+DESIGNATE_PERIODIC_SYNC_INTERVAL=${DESIGNATE_PERIODIC_SYNC_INTERVAL:-1800}
11
+DESIGNATE_COORDINATION_URL=${DESIGNATE_COORDINATION_URL:-}
12
+
13
+# Default extensions
14
+DESIGNATE_ENABLED_EXTENSIONS_V1=${DESIGNATE_ENABLED_EXTENSIONS_V1:-"quotas"}
15
+DESIGNATE_ENABLED_EXTENSIONS_V2=${DESIGNATE_ENABLED_EXTENSIONS_V2:-""}
16
+DESIGNATE_ENABLED_EXTENSIONS_ADMIN=${DESIGNATE_ENABLED_EXTENSIONS_ADMIN:-"quotas"}
17
+
18
+# Default IP/port settings
19
+DESIGNATE_SERVICE_PROTOCOL=${DESIGNATE_SERVICE_PROTOCOL:-$SERVICE_PROTOCOL}
20
+DESIGNATE_SERVICE_HOST=${DESIGNATE_SERVICE_HOST:-$SERVICE_HOST}
21
+DESIGNATE_SERVICE_PORT=${DESIGNATE_SERVICE_PORT:-9001}
22
+DESIGNATE_SERVICE_PORT_INT=${DESIGNATE_SERVICE_PORT_INT:-19001}
23
+DESIGNATE_SERVICE_PORT_DNS=${DESIGNATE_SERVICE_PORT_DNS:-53}
24
+DESIGNATE_SERVICE_PORT_MDNS=${DESIGNATE_SERVICE_PORT_MDNS:-5354}
25
+
26
+# Default directories
27
+DESIGNATE_BIN_DIR=$(get_python_exec_prefix)
28
+DESIGNATE_DIR=$DEST/designate
29
+DESIGNATEDASHBOARD_DIR=$DEST/designate-dashboard
30
+DESIGNATE_CONF_DIR=/etc/designate
31
+DESIGNATE_STATE_PATH=${DESIGNATE_STATE_PATH:=$DATA_DIR/designate}
32
+DESIGNATE_CONF=$DESIGNATE_CONF_DIR/designate.conf
33
+DESIGNATE_LOG_DIR=/var/log/designate
34
+DESIGNATE_AUTH_CACHE_DIR=${DESIGNATE_AUTH_CACHE_DIR:-/var/cache/designate}
35
+DESIGNATE_ROOTWRAP_CONF=$DESIGNATE_CONF_DIR/rootwrap.conf
36
+DESIGNATE_APIPASTE_CONF=$DESIGNATE_CONF_DIR/api-paste.ini
37
+DESIGNATE_PLUGINS=$DESIGNATE_DIR/devstack/designate_plugins
38
+
39
+# Default repositories
40
+DESIGNATE_REPO=${DESIGNATE_REPO:-${GIT_BASE}/openstack/designate.git}
41
+DESIGNATE_BRANCH=${DESIGNATE_BRANCH:-master}
42
+DESIGNATEDASHBOARD_REPO=${DESIGNATEDASHBOARD_REPO:-${GIT_BASE}/openstack/designate-dashboard.git}
43
+DESIGNATEDASHBOARD_BRANCH=${DESIGNATEDASHBOARD_BRANCH:-master}
44
+GITDIR["python-designateclient"]=$DEST/python-designateclient
45
+
46
+# Tell Tempest this project is present
47
+TEMPEST_SERVICES+=,designate
48
+
49
+# Turn on all Designate services by default
50
+
51
+enable_service designate
52
+enable_service designate-central
53
+enable_service designate-api
54
+enable_service designate-pool-manager
55
+enable_service designate-zone-manager
56
+enable_service designate-mdns
57
+enable_service designate-agent
58
+enable_service designate-sink

+ 1
- 1
tox.ini View File

@@ -42,7 +42,7 @@ commands = sh tools/pretty_flake8.sh
42 42
 [testenv:bashate]
43 43
 deps = bashate
44 44
 whitelist_externals = bash
45
-commands = bash -c "find {toxinidir}/contrib/devstack \
45
+commands = bash -c "find {toxinidir}/devstack         \
46 46
          -not \( -type d -name .?\* -prune \)         \ # prune all 'dot' dirs
47 47
          -not \( -type d -name doc -prune \)          \ # skip documentation
48 48
          -type f                                      \ # only files

Loading…
Cancel
Save