Split ovn plugin and northd configuration
authorSteven Hardy <shardy@redhat.com>
Tue, 18 Oct 2016 10:50:51 +0000 (11:50 +0100)
committerDan Radez <dradez@redhat.com>
Tue, 22 Nov 2016 17:42:36 +0000 (12:42 -0500)
This allows us to use the composable services interfaces to handle
providing the IP address for northd, and will be more flexible in
the event folks want to deploy northd/ovndb on a different node to
the neutron plugin.

This also adds ovn_northd to the haproxy configuration so we can access
it via the ovn_northd_vip in other service profiles.  Note we need
to ensure the haproxy config only hits the bootstrap node as northd
won't be running on the other nodes.

Change-Id: I9af7bd837c340c3df016fc7ad4238b2941ba7a95
Partial-Bug: #1634171

manifests/haproxy.pp
manifests/profile/base/neutron/agents/ovn.pp
manifests/profile/base/neutron/ovn_northd.pp [new file with mode: 0644]
manifests/profile/base/neutron/plugins/ml2/ovn.pp

index ededc76..b9c8835 100644 (file)
 #  (optional) Enable or not OpenDaylight binding
 #  Defaults to hiera('opendaylight_api_enabled', false)
 #
+# [*ovn_dbs*]
+#  (optional) Enable or not OVN northd binding
+#  Defaults to hiera('ovn_dbs_enabled', false)
+#
 # [*zaqar_ws*]
 #  (optional) Enable or not Zaqar Websockets binding
 #  Defaults to false
 #  (optional) Specify the network panko is running on.
 #  Defaults to hiera('panko_api_network', undef)
 #
+# [*ovn_dbs_network*]
+#  (optional) Specify the network ovn_dbs is running on.
+#  Defaults to hiera('ovn_dbs_network', undef)
+#
 # [*sahara_network*]
 #  (optional) Specify the network sahara is running on.
 #  Defaults to hiera('sahara_api_network', undef)
 #    'nova_novnc_ssl_port' (Defaults to 13080)
 #    'panko_api_port' (Defaults to 8779)
 #    'panko_api_ssl_port' (Defaults to 13779)
+#    'ovn_nbdb_port' (Defaults to 6641)
+#    'ovn_sbdb_port' (Defaults to 6642)
 #    'sahara_api_port' (Defaults to 8386)
 #    'sahara_api_ssl_port' (Defaults to 13386)
 #    'swift_proxy_port' (Defaults to 8080)
@@ -509,6 +519,7 @@ class tripleo::haproxy (
   $zaqar_api                   = hiera('zaqar_api_enabled', false),
   $ceph_rgw                    = hiera('ceph_rgw_enabled', false),
   $opendaylight                = hiera('opendaylight_api_enabled', false),
+  $ovn_dbs                     = hiera('ovn_dbs_enabled', false),
   $zaqar_ws                    = hiera('zaqar_api_enabled', false),
   $ui                          = hiera('enable_ui', false),
   $aodh_network                = hiera('aodh_api_network', undef),
@@ -534,6 +545,7 @@ class tripleo::haproxy (
   $nova_novncproxy_network     = hiera('nova_vnc_proxy_network', undef),
   $nova_osapi_network          = hiera('nova_api_network', undef),
   $panko_network               = hiera('panko_api_network', undef),
+  $ovn_dbs_network             = hiera('ovn_dbs_network', undef),
   $sahara_network              = hiera('sahara_api_network', undef),
   $swift_proxy_server_network  = hiera('swift_proxy_network', undef),
   $trove_network               = hiera('trove_api_network', undef),
@@ -583,6 +595,8 @@ class tripleo::haproxy (
     nova_novnc_ssl_port => 13080,
     panko_api_port => 8779,
     panko_api_ssl_port => 13779,
+    ovn_nbdb_port => 6641,
+    ovn_sbdb_port => 6642,
     sahara_api_port => 8386,
     sahara_api_ssl_port => 13386,
     swift_proxy_port => 8080,
@@ -1311,6 +1325,39 @@ class tripleo::haproxy (
     }
   }
 
+
+  if $ovn_dbs {
+    # FIXME: is this config enough to ensure we only hit the first node in
+    # ovn_northd_node_ips ?
+    $ovn_db_listen_options = {
+      'option'         => [ 'tcpka' ],
+      'timeout client' => '90m',
+      'timeout server' => '90m',
+      'stick-table'    => 'type ip size 1000',
+      'stick'          => 'on dst',
+    }
+    ::tripleo::haproxy::endpoint { 'ovn_nbdb':
+      public_virtual_ip => $public_virtual_ip,
+      internal_ip       => hiera('ovn_dbs_vip', $controller_virtual_ip),
+      service_port      => $ports[ovn_nbdb_port],
+      ip_addresses      => hiera('ovn_dbs_node_ips', $controller_hosts_real),
+      server_names      => hiera('ovn_dbs_node_names', $controller_hosts_names_real),
+      service_network   => $ovn_dbs_network,
+      listen_options    => $ovn_db_listen_options,
+      mode              => 'tcp'
+    }
+    ::tripleo::haproxy::endpoint { 'ovn_sbdb':
+      public_virtual_ip => $public_virtual_ip,
+      internal_ip       => hiera('ovn_dbs_vip', $controller_virtual_ip),
+      service_port      => $ports[ovn_sbdb_port],
+      ip_addresses      => hiera('ovn_dbs_node_ips', $controller_hosts_real),
+      server_names      => hiera('ovn_dbs_node_names', $controller_hosts_names_real),
+      service_network   => $ovn_dbs_network,
+      listen_options    => $ovn_db_listen_options,
+      mode              => 'tcp'
+    }
+  }
+
   if $zaqar_ws {
     ::tripleo::haproxy::endpoint { 'zaqar_ws':
       public_virtual_ip         => $public_virtual_ip,
index 443b164..a593092 100644 (file)
 # OVN Neutron agent profile for tripleo
 #
 # [*ovn_db_host*]
-#   The IP-Address/Hostname where OVN DBs are deployed
+#   (Optional) The IP-Address where OVN DBs are listening.
+#   Defaults to hiera('ovn_dbs_vip')
+#
+# [*ovn_sbdb_port*]
+#   (Optional) Port number on which southbound database is listening
+#   Defaults to hiera('ovn::southbound::port')
 #
 # [*step*]
 #   (Optional) The current step in deployment. See tripleo-heat-templates
 #   Defaults to hiera('step')
 #
 class tripleo::profile::base::neutron::agents::ovn (
-  $ovn_db_host,
-  $step = hiera('step')
+  $ovn_db_host    = hiera('ovn_dbs_vip'),
+  $ovn_sbdb_port  = hiera('ovn::southbound::port'),
+  $step           = hiera('step')
 ) {
   if $step >= 4 {
-    $ovn_sbdb_port = hiera('ovn::southbound::port')
     class { '::ovn::controller':
       ovn_remote     => "tcp:${ovn_db_host}:${ovn_sbdb_port}",
-      ovn_encap_type => hiera('ovn::southboud::encap_type')
     }
   }
 }
diff --git a/manifests/profile/base/neutron/ovn_northd.pp b/manifests/profile/base/neutron/ovn_northd.pp
new file mode 100644 (file)
index 0000000..0b46d5c
--- /dev/null
@@ -0,0 +1,40 @@
+# Copyright 2016 Red Hat, 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.
+#
+# == Class: tripleo::profile::base::neutron::plugins::ml2::ovn
+#
+# OVN Neutron northd profile for tripleo
+#
+# [*bootstrap_node*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+class tripleo::profile::base::neutron::ovn_northd (
+  $bootstrap_node = hiera('bootstrap_nodeid', undef),
+  $step           = hiera('step'),
+) {
+  if $step >= 4 {
+    # Note this only runs on the first node in the cluster when
+    # deployed on a role where multiple nodes exist.
+    if $::hostname == downcase($bootstrap_node) {
+      include ::ovn::northd
+    }
+  }
+}
+
index 46477a7..b5b7a0a 100644 (file)
 # OVN Neutron ML2 profile for tripleo
 #
 # [*ovn_db_host*]
-#   The IP-Address/Hostname where OVN DBs are deployed
+#   The IP-Address where OVN DBs are listening.
+#   Defaults to hiera('ovn_dbs_vip')
+#
+# [*ovn_nb_port*]
+#   (Optional) Port number on which northbound database is listening
+#   Defaults to hiera('ovn::northbound::port')
+#
+# [*ovn_sb_port*]
+#   (Optional) Port number on which southbound database is listening
+#   Defaults to hiera('ovn::southbound::port')
 #
 # [*step*]
 #   (Optional) The current step in deployment. See tripleo-heat-templates
 #   Defaults to hiera('step')
 #
 class tripleo::profile::base::neutron::plugins::ml2::ovn (
-  $ovn_db_host,
-  $step = hiera('step')
+  $ovn_db_host = hiera('ovn_dbs_vip'),
+  $ovn_nb_port = hiera('ovn::northbound::port'),
+  $ovn_sb_port = hiera('ovn::southbound::port'),
+  $step        = hiera('step')
 ) {
   if $step >= 4 {
-    if $::hostname == $ovn_db_host {
-      # NOTE: we might split northd from plugin later, in the case of
-      # micro-services, where neutron-server & northd are not in the same
-      # containers
-      include ::ovn::northd
-    }
-    $ovn_nb_port = hiera('ovn::northbound::port')
-    $ovn_sb_port = hiera('ovn::southbound::port')
     class { '::neutron::plugins::ml2::ovn':
       ovn_nb_connection => "tcp:${ovn_db_host}:${ovn_nb_port}",
       ovn_sb_connection => "tcp:${ovn_db_host}:${ovn_sb_port}",