loadbalancer: add Gnocchi API support
authorEmilien Macchi <emilien@redhat.com>
Tue, 1 Dec 2015 18:48:56 +0000 (13:48 -0500)
committerEmilien Macchi <emilien@redhat.com>
Tue, 1 Dec 2015 18:49:27 +0000 (13:49 -0500)
Add Gnocchi (OpenStack Metric storage) support in TripleO Loadbalancer config.

Change-Id: Ia991819f57616a9a11bd4dfb77893748130268a0

manifests/loadbalancer.pp

index 2fcfac6..ec38c5c 100644 (file)
 #  When set, enables SSL on the Aodh public API endpoint using the specified file.
 #  Defaults to undef
 #
+# [*gnocchi_certificate*]
+#  Filename of an HAProxy-compatible certificate and key file
+#  When set, enables SSL on the Gnocchi public API endpoint using the specified file.
+#  Defaults to undef
+#
 # [*swift_certificate*]
 #  Filename of an HAProxy-compatible certificate and key file
 #  When set, enables SSL on the Swift public API endpoint using the specified file.
 #  (optional) Enable or not Aodh API binding
 #  Defaults to false
 #
+# [*gnocchi*]
+#  (optional) Enable or not Gnocchi API binding
+#  Defaults to false
+#
 # [*swift_proxy_server*]
 #  (optional) Enable or not Swift API binding
 #  Defaults to false
@@ -272,6 +281,7 @@ class tripleo::loadbalancer (
   $nova_certificate          = undef,
   $ceilometer_certificate    = undef,
   $aodh_certificate          = undef,
+  $gnocchi_certificate       = undef,
   $swift_certificate         = undef,
   $heat_certificate          = undef,
   $horizon_certificate       = undef,
@@ -289,6 +299,7 @@ class tripleo::loadbalancer (
   $nova_novncproxy           = false,
   $ceilometer                = false,
   $aodh                      = false,
+  $gnocchi                   = false,
   $swift_proxy_server        = false,
   $heat_api                  = false,
   $heat_cloudwatch           = false,
@@ -437,6 +448,11 @@ class tripleo::loadbalancer (
   } else {
     $aodh_bind_certificate = $service_certificate
   }
+  if $gnocchi_certificate {
+    $gnocchi_bind_certificate = $gnocchi_certificate
+  } else {
+    $gnocchi_bind_certificate = $service_certificate
+  }
   if $swift_certificate {
     $swift_bind_certificate = $swift_certificate
   } else {
@@ -587,6 +603,19 @@ class tripleo::loadbalancer (
     }
   }
 
+  $gnocchi_api_vip = hiera('gnocchi_api_vip', $controller_virtual_ip)
+  if $gnocchi_bind_certificate {
+    $gnocchi_bind_opts = {
+      "${gnocchi_api_vip}:8041" => [],
+      "${public_virtual_ip}:13041" => ['ssl', 'crt', $gnocchi_bind_certificate],
+    }
+  } else {
+    $gnocchi_bind_opts = {
+      "${gnocchi_api_vip}:8041" => [],
+      "${public_virtual_ip}:8041" => [],
+    }
+  }
+
   $swift_proxy_vip = hiera('swift_proxy_vip', $controller_virtual_ip)
   if $swift_bind_certificate {
     $swift_bind_opts = {
@@ -883,6 +912,20 @@ class tripleo::loadbalancer (
     }
   }
 
+  if $gnocchi {
+    haproxy::listen { 'gnocchi':
+      bind             => $gnocchi_bind_opts,
+      collect_exported => false,
+    }
+    haproxy::balancermember { 'gnocchi':
+      listening_service => 'gnocchi',
+      ports             => '8041',
+      ipaddresses       => hiera('gnocchi_api_node_ips', $controller_hosts_real),
+      server_names      => $controller_hosts_names_real,
+      options           => ['check', 'inter 2000', 'rise 2', 'fall 5'],
+    }
+  }
+
   if $swift_proxy_server {
     haproxy::listen { 'swift_proxy_server':
       bind             => $swift_bind_opts,