File: backend-ns1

package info (click to toggle)
designate 1%3A21.0.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,860 kB
  • sloc: python: 49,608; sh: 1,914; sql: 155; makefile: 83; javascript: 3
file content (108 lines) | stat: -rw-r--r-- 2,993 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/usr/bin/env bash
# Configure the NS1 backend

# Requirements:
# A working NS1 managed DNS / DDI environment is needed to use this DevStack plugin.

# Enable with:
# DESIGNATE_BACKEND_DRIVER=ns1

# Dependencies:
# ``functions`` file
# ``designate`` configuration

# install_designate_backend - install any external requirements
# configure_designate_backend - make configuration changes, including those to other services
# init_designate_backend - initialize databases, etc.
# start_designate_backend - start any external services
# stop_designate_backend - stop any external services
# cleanup_designate_backend - remove transient data and cache

# Save trace setting
DP_NS1_XTRACE=$(set +o | grep xtrace)
set +o xtrace

# Defaults
# --------

DESIGNATE_NS1_DNS_IP=${DESIGNATE_NS1_DNS_IP:-172.31.45.104}
DESIGNATE_NS1_DNS_PORT=${DESIGNATE_NS1_DNS_PORT:-5333}
DESIGNATE_NS1_XFR_IP=${DESIGNATE_NS1_XFR_IP:-172.31.45.104}
DESIGNATE_NS1_XFR_PORT=${DESIGNATE_NS1_XFR_PORT:-5400}
DESIGNATE_NS1_API_IP=${DESIGNATE_NS1_API_IP:-172.31.45.104}
DESIGNATE_NS1_API_TOKEN=${DESIGNATE_NS1_API_TOKEN:-default}


# Entry Points
# ------------


# install_designate_backend - install any external requirements
function install_designate_backend {
    if is_ubuntu; then
        install_package python-dev libxslt1-dev libxslt1.1 libxml2-dev libxml2 libssl-dev
    elif is_fedora; then
        install_package python-devel libxslt1-devel libxslt1.1 libxml2-devel libxml2 libssl-devel
    fi
}

# configure_designate_backend - make configuration changes, including those to other services
function configure_designate_backend {

    # Generate Designate pool.yaml file
    sudo tee $DESIGNATE_CONF_DIR/pools.yaml > /dev/null <<EOF
---
- name: default
  description: DevStack NS1 Pool
  attributes: {}

  ns_records:
    - hostname: $DESIGNATE_DEFAULT_NS_RECORD
      priority: 1

  nameservers:
    - host: $DESIGNATE_NS1_DNS_IP
      port: $DESIGNATE_NS1_DNS_PORT

  targets:
    - type: ns1
      description: NS1 Managed DNS

      masters:
        - host: $(ipv6_unquote $DESIGNATE_SERVICE_HOST)
          port: $DESIGNATE_SERVICE_PORT_MDNS

      options:
        host: $DESIGNATE_NS1_XFR_IP
        port: $DESIGNATE_NS1_XFR_PORT
        api_endpoint: $DESIGNATE_NS1_API_IP
        api_token: $DESIGNATE_NS1_API_TOKEN
        # NOTE: TSIG key has to be set manually if it's necessary
        #tsigkey_name: testkey
        #tsigkey_hash: hmac-sha512
        #tsigkey_value: 4EJz00m4ZWe005HjLiXRedJbSnCUx5Dt+4wVYsBweG5HKAV6cqSVJ/oem/6mLgDNFAlLP3Jg0npbg1SkP7RMDg==
EOF
}

# init_designate_backend - initialize databases, etc.
function init_designate_backend {
    :
}

# start_designate_backend - start any external services
function start_designate_backend {
    :
}

# stop_designate_backend - stop any external services
function stop_designate_backend {
    :
}

# cleanup_designate_backend - remove transient data and cache
function cleanup_designate_backend {
    :
}

# Restore xtrace
$DP_NS1_XTRACE