Adding congress service
authorDan Radez <dradez@redhat.com>
Thu, 22 Dec 2016 03:13:11 +0000 (22:13 -0500)
committerDan Radez <dradez@redhat.com>
Thu, 26 Jan 2017 13:26:43 +0000 (08:26 -0500)
Change-Id: Ic74ccd5fa7b3b04ca810416e5160463252f17474
Signed-off-by: Dan Radez <dradez@redhat.com>
manifests/haproxy.pp
manifests/profile/base/congress.pp [new file with mode: 0644]
manifests/profile/base/database/mysql.pp
manifests/profile/base/keystone.pp

index c399a96..e90b0fb 100644 (file)
 #  (optional) Enable or not Cinder API binding
 #  Defaults to hiera('cinder_api_enabled', false)
 #
+# [*congress*]
+#  (optional) Enable or not Congress API binding
+#  Defaults to hiera('congress_enabled', false)
+#
 # [*manila*]
 #  (optional) Enable or not Manila API binding
 #  Defaults to hiera('manila_api_enabled', false)
 #  (optional) Specify the network cinder is running on.
 #  Defaults to hiera('cinder_api_network', undef)
 #
+# [*congress_network*]
+#  (optional) Specify the network congress is running on.
+#  Defaults to hiera('congress_api_network', undef)
+#
 # [*docker_registry_network*]
 #  (optional) Specify the network docker-registry is running on.
 #  Defaults to hiera('docker_registry_network', undef)
@@ -523,6 +531,7 @@ class tripleo::haproxy (
   $keystone_public             = hiera('keystone_enabled', false),
   $neutron                     = hiera('neutron_api_enabled', false),
   $cinder                      = hiera('cinder_api_enabled', false),
+  $congress                    = hiera('congress_enabled', false),
   $manila                      = hiera('manila_api_enabled', false),
   $sahara                      = hiera('sahara_api_enabled', false),
   $tacker                      = hiera('tacker_enabled', false),
@@ -567,6 +576,7 @@ class tripleo::haproxy (
   $ceilometer_network          = hiera('ceilometer_api_network', undef),
   $ceph_rgw_network            = hiera('ceph_rgw_network', undef),
   $cinder_network              = hiera('cinder_api_network', undef),
+  $congress_network            = hiera('congress_api_network', undef),
   $docker_registry_network     = hiera('docker_registry_network', undef),
   $glance_api_network          = hiera('glance_api_network', undef),
   $gnocchi_network             = hiera('gnocchi_api_network', undef),
@@ -604,6 +614,8 @@ class tripleo::haproxy (
     ceilometer_api_ssl_port => 13777,
     cinder_api_port => 8776,
     cinder_api_ssl_port => 13776,
+    congress_api_port => 1789,
+    congress_api_ssl_port => 13789,
     docker_registry_port => 8787,
     docker_registry_ssl_port => 13787,
     glance_api_port => 9292,
@@ -885,6 +897,24 @@ class tripleo::haproxy (
     }
   }
 
+  if $congress {
+    ::tripleo::haproxy::endpoint { 'congress':
+      public_virtual_ip => $public_virtual_ip,
+      internal_ip       => hiera('congress_api_vip', $controller_virtual_ip),
+      service_port      => $ports[congress_api_port],
+      ip_addresses      => hiera('congress_node_ips', $controller_hosts_real),
+      server_names      => hiera('congress_api_node_names', $controller_hosts_names_real),
+      mode              => 'http',
+      listen_options    => {
+          'http-request' => [
+            'set-header X-Forwarded-Proto https if { ssl_fc }',
+            'set-header X-Forwarded-Proto http if !{ ssl_fc }'],
+      },
+      public_ssl_port   => $ports[congress_api_ssl_port],
+      service_network   => $congress_network,
+    }
+  }
+
   if $manila {
     ::tripleo::haproxy::endpoint { 'manila':
       public_virtual_ip => $public_virtual_ip,
diff --git a/manifests/profile/base/congress.pp b/manifests/profile/base/congress.pp
new file mode 100644 (file)
index 0000000..1731e81
--- /dev/null
@@ -0,0 +1,86 @@
+# 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::congress
+#
+# Congress server profile for tripleo
+#
+# === Parameters
+#
+# [*bootstrap_node*]
+#   (Optional) The hostname of the node responsible for bootstrapping tasks
+#   Defaults to hiera('bootstrap_nodeid')
+#
+# [*messaging_driver*]
+#   Driver for messaging service.
+#   Defaults to hiera('messaging_service_name', 'rabbit')
+#
+# [*messaging_hosts*]
+#   list of the messaging host fqdns
+#   Defaults to hiera('rabbitmq_node_names')
+#
+# [*messaging_password*]
+#   Password for messaging congress queue
+#   Defaults to hiera('congress::rabbit_password')
+#
+# [*messaging_port*]
+#   IP port for messaging service
+#   Defaults to hiera('congress::rabbit_port', 5672)
+#
+# [*messaging_username*]
+#   Username for messaging congress queue
+#   Defaults to hiera('congress::rabbit_userid', 'guest')
+#
+# [*messaging_use_ssl*]
+#   Flag indicating ssl usage.
+#   Defaults to hiera('congress::rabbit_use_ssl', '0')
+#
+# [*step*]
+#   (Optional) The current step of the deployment
+#   Defaults to hiera('step')
+
+class tripleo::profile::base::congress (
+  $bootstrap_node       = hiera('bootstrap_nodeid', undef),
+  $messaging_driver     = hiera('messaging_service_name', 'rabbit'),
+  $messaging_hosts      = any2array(hiera('rabbitmq_node_names', undef)),
+  $messaging_password   = hiera('congress::rabbit_password'),
+  $messaging_port       = hiera('congress::rabbit_port', '5672'),
+  $messaging_username   = hiera('congress::rabbit_userid', 'guest'),
+  $messaging_use_ssl    = hiera('congress::rabbit_use_ssl', '0'),
+  $step                 = hiera('step'),
+) {
+  if $::hostname == downcase($bootstrap_node) {
+    $sync_db = true
+  } else {
+    $sync_db = false
+  }
+
+  if $step >= 4 or ($step >= 3 and $sync_db){
+    $messaging_use_ssl_real = sprintf('%s', bool2num(str2bool($messaging_use_ssl)))
+    class { '::congress':
+      sync_db               => $sync_db,
+      default_transport_url => os_transport_url({
+        'transport' => $messaging_driver,
+        'hosts'     => $messaging_hosts,
+        'port'      => sprintf('%s', $messaging_port),
+        'username'  => $messaging_username,
+        'password'  => $messaging_password,
+        'ssl'       => $messaging_use_ssl_real,
+      }),
+    }
+
+    include ::congress::server
+    include ::congress::db
+  }
+}
index 6f93903..4ccfabc 100644 (file)
@@ -151,6 +151,9 @@ class tripleo::profile::base::database::mysql (
     if hiera('cinder_api_enabled', false) {
       include ::cinder::db::mysql
     }
+    if hiera('congress_enabled', false) {
+      include ::congress::db::mysql
+    }
     if hiera('glance_api_enabled', false) {
       include ::glance::db::mysql
     }
index e84e22f..72049e3 100644 (file)
@@ -209,6 +209,9 @@ class tripleo::profile::base::keystone (
     if hiera('cinder_api_enabled', false) {
       include ::cinder::keystone::auth
     }
+    if hiera('congress_enabled', false) {
+      include ::congress::keystone::auth
+    }
     if hiera('glance_api_enabled', false) {
       include ::glance::keystone::auth
     }