Add NS server entries to the model and deploy pdns on backend

Related-PROD: https://mirantis.jira.com/browse/PROD-12631
Related-PROD: https://mirantis.jira.com/browse/PROD-14396

Depends-On: I214d8db39365648b5ef9348b52edd839327ca197
Change-Id: I5a6eaa31bb0b9f4277dbec5eb8c7464546079b9f
diff --git a/classes/cluster/virtual-mcp-ocata-dvr/infra/config.yml b/classes/cluster/virtual-mcp-ocata-dvr/infra/config.yml
index eba6c65..48bfdb4 100644
--- a/classes/cluster/virtual-mcp-ocata-dvr/infra/config.yml
+++ b/classes/cluster/virtual-mcp-ocata-dvr/infra/config.yml
@@ -19,6 +19,7 @@
 - system.keystone.client.service.cinder3
 - system.keystone.client.service.designate
 - system.mysql.client.single
+- system.reclass.storage.system.openstack_dns_cluster
 - system.reclass.storage.system.openstack_control_cluster
 - system.reclass.storage.system.openstack_compute_multi
 - system.reclass.storage.system.openstack_gateway_single
diff --git a/classes/cluster/virtual-mcp-ocata-dvr/init.yml b/classes/cluster/virtual-mcp-ocata-dvr/init.yml
index bd4c2e4..8ddaf13 100644
--- a/classes/cluster/virtual-mcp-ocata-dvr/init.yml
+++ b/classes/cluster/virtual-mcp-ocata-dvr/init.yml
@@ -38,6 +38,8 @@
     openstack_message_queue_node03_address: ${_param:openstack_control_node03_address}
     openstack_gateway_address: 172.16.10.110
     openstack_gateway_node01_address: ${_param:openstack_gateway_address}
+    openstack_dns_node01_address: 172.16.10.111
+    openstack_dns_node02_address: 172.16.10.112
     # stacklight service addresses
     stacklight_monitor_address: 172.16.10.253
     stacklight_monitor_node01_address: 172.16.10.107
diff --git a/classes/cluster/virtual-mcp-ocata-dvr/openstack/control.yml b/classes/cluster/virtual-mcp-ocata-dvr/openstack/control.yml
index 4fb5eaa..0ec3e9a 100644
--- a/classes/cluster/virtual-mcp-ocata-dvr/openstack/control.yml
+++ b/classes/cluster/virtual-mcp-ocata-dvr/openstack/control.yml
@@ -63,13 +63,6 @@
       instance:
         VIP:
           virtual_router_id: 150
-  powerdns:
-    server:
-      axfr_ips:
-        - ${_param:openstack_control_node01_address}
-        - ${_param:openstack_control_node02_address}
-        - ${_param:openstack_control_node03_address}
-        - 127.0.0.1
   keystone:
     server:
       admin_email: ${_param:admin_email}
@@ -77,6 +70,9 @@
         driver: messagingv2
         topics: "notifications,${_param:stacklight_notification_topic}"
   designate:
+    pool_manager:
+      enabled: ${_param:designate_pool_manager_enabled}
+      periodic_sync_interval: ${_param:designate_pool_manager_periodic_sync_interval}
     server:
       pools:
         default:
@@ -89,18 +85,9 @@
               description: 'test target2'
               masters: ${_param:designate_pool_target_masters}
               options:
-                host: ${_param:openstack_control_node02_address}
+                host: ${_param:openstack_dns_node02_address}
                 port: 53
-                api_endpoint: "http://${_param:openstack_control_node02_address}:${_param:powerdns_webserver_port}"
-                api_token: ${_param:designate_pdns_api_key}
-            default2:
-              type: ${_param:designate_pool_target_type}
-              description: 'test target3'
-              masters: ${_param:designate_pool_target_masters}
-              options:
-                host: ${_param:openstack_control_node03_address}
-                port: 53
-                api_endpoint: "http://${_param:openstack_control_node03_address}:${_param:powerdns_webserver_port}"
+                api_endpoint: "http://${_param:openstack_dns_node02_address}:${_param:powerdns_webserver_port}"
                 api_token: ${_param:designate_pdns_api_key}
   glance:
     server:
diff --git a/classes/cluster/virtual-mcp-ocata-dvr/openstack/dns.yml b/classes/cluster/virtual-mcp-ocata-dvr/openstack/dns.yml
new file mode 100644
index 0000000..5e17e0e
--- /dev/null
+++ b/classes/cluster/virtual-mcp-ocata-dvr/openstack/dns.yml
@@ -0,0 +1,35 @@
+classes:
+- system.powerdns.server.single
+- cluster.virtual-mcp-ocata-dvr
+
+parameters:
+  powerdns:
+    server:
+      api:
+          enabled: True
+          key: ${_param:designate_pdns_api_key}
+      axfr_ips:
+          ${_param:powerdns_axfr_ips}
+      bind:
+          address: ${_param:single_address}
+      overwrite_supermasters: True
+      supermasters:
+          ${_param:powerdns_supermasters}
+      webserver:
+          enabled: True
+          address: ${_param:single_address}
+          password: ${_param:powerdns_webserver_password}
+          port: ${_param:powerdns_webserver_port}
+  linux:
+    system:
+      package:
+        python-msgpack:
+          version: latest
+    network:
+      interface:
+        ens4:
+          enabled: true
+          type: eth
+          proto: static
+          address: ${_param:single_address}
+          netmask: 255.255.255.0
diff --git a/classes/cluster/virtual-mcp-ocata-dvr/openstack/init.yml b/classes/cluster/virtual-mcp-ocata-dvr/openstack/init.yml
index 9b67ace..c3f3a4b 100644
--- a/classes/cluster/virtual-mcp-ocata-dvr/openstack/init.yml
+++ b/classes/cluster/virtual-mcp-ocata-dvr/openstack/init.yml
@@ -33,31 +33,51 @@
     rabbitmq_admin_password: workshop
     rabbitmq_openstack_password: workshop
     rabbitmq_cold_password: workshop
+    powerdns_axfr_ips:
+      - ${_param:openstack_control_node01_address}
+      - ${_param:openstack_control_node02_address}
+      - ${_param:openstack_control_node03_address}
+      - 127.0.0.1
+    powerdns_supermasters:
+      - ip: ${_param:openstack_control_node01_address}
+        nameserver: ns1.example.org
+        account: master
+      - ip: ${_param:openstack_control_node02_address}
+        nameserver: ns2.example.org
+        account: master
+      - ip: ${_param:openstack_control_node03_address}
+        nameserver: ns3.example.org
+        account: master
+    powerdns_overwrite_supermasters: True
     powerdns_webserver_password: gJ6n3gVaYP8eS
     powerdns_webserver_port: 8081
     designate_domain_id: 5186883b-91fb-4891-bd49-e6769234a8fc
     designate_pdns_api_key: VxK9cMlFL5Ae
-    designate_pdns_api_endpoint: "http://${_param:openstack_control_node01_address}:${_param:powerdns_webserver_port}"
+    designate_pdns_api_endpoint: "http://${_param:openstack_dns_node01_address}:${_param:powerdns_webserver_port}"
+    designate_pool_manager_enabled: True
+    designate_pool_manager_periodic_sync_interval: '120'
     designate_pool_ns_records:
       - hostname: 'ns1.example.org.'
         priority: 10
+      - hostname: 'ns2.example.org.'
+        priority: 20
+      - hostname: 'ns3.example.org.'
+        priority: 30
     designate_pool_nameservers:
-      - host: ${_param:openstack_control_node01_address}
+      - host: ${_param:openstack_dns_node01_address}
         port: 53
-      - host: ${_param:openstack_control_node02_address}
-        port: 53
-      - host: ${_param:openstack_control_node03_address}
+      - host: ${_param:openstack_dns_node02_address}
         port: 53
     designate_pool_target_type: pdns4
     designate_pool_target_masters:
       - host: ${_param:openstack_control_node01_address}
-        port: 5354
+        port: 53
       - host: ${_param:openstack_control_node02_address}
-        port: 5354
+        port: 53
       - host: ${_param:openstack_control_node03_address}
-        port: 5354
+        port: 53
     designate_pool_target_options:
-      host: ${_param:openstack_control_node01_address}
+      host: ${_param:openstack_dns_node01_address}
       port: 53
       api_token: ${_param:designate_pdns_api_key}
       api_endpoint: ${_param:designate_pdns_api_endpoint}
@@ -168,8 +188,18 @@
           names:
           - cmp02
           - cmp02.${_param:cluster_domain}
+        dns01:
+          address: ${_param:openstack_dns_node01_address}
+          names:
+          - dns01
+          - dns01.${_param:cluster_domain}
+        dns02:
+          address: ${_param:openstack_dns_node02_address}
+          names:
+          - dns02
+          - dns02.${_param:cluster_domain}
     system:
       user:
         root:
           name: root
-          password: false
\ No newline at end of file
+          password: false