Implement Nova ec2api profile
authorSven Anderson <sven@redhat.com>
Fri, 1 Jul 2016 13:14:21 +0000 (15:14 +0200)
committerSven Anderson <sven@redhat.com>
Fri, 20 Jan 2017 13:08:30 +0000 (14:08 +0100)
Change-Id: If4b091e1ca02f43aa9c65392baf8ceea007b7cfb

manifests/haproxy.pp
manifests/profile/base/database/mysql.pp
manifests/profile/base/keystone.pp
manifests/profile/base/nova/ec2api.pp [new file with mode: 0644]

index 2fa02c9..81ef0a6 100644 (file)
 #  (optional) Enable or not Nova novncproxy binding
 #  Defaults to hiera('nova_vnc_proxy_enabled', false)
 #
+# [*ec2_api*]
+#  (optional) Enable or not EC2 API binding
+#  Defaults to hiera('ec2_api_enabled', false)
+#
+# [*ec2_api_metadata*]
+#  (optional) Enable or not EC2 API metadata binding
+#  Defaults to hiera('ec2_api_enabled', false)
+#
 # [*ceilometer*]
 #  (optional) Enable or not Ceilometer API binding
 #  Defaults to hiera('ceilometer_api_enabled', false)
 #  (optional) Specify the network nova_placement is running on.
 #  Defaults to hiera('nova_placement_network', undef)
 #
+# [*ec2_api_network*]
+#  (optional) Specify the network ec2_api is running on.
+#  Defaults to hiera('ec2_api_network', undef)
+#
+# [*ec2_api_metadata_network*]
+#  (optional) Specify the network ec2_api_metadata is running on.
+#  Defaults to hiera('ec2_api_network', undef)
+#
 # [*opendaylight_network*]
 #  (optional) Specify the network opendaylight is running on.
 #  Defaults to hiera('opendaylight_api_network', undef)
@@ -517,6 +533,8 @@ class tripleo::haproxy (
   $nova_placement              = hiera('nova_placement_enabled', false),
   $nova_metadata               = hiera('nova_api_enabled', false),
   $nova_novncproxy             = hiera('nova_vnc_proxy_enabled', false),
+  $ec2_api                     = hiera('ec2_api_enabled', false),
+  $ec2_api_metadata            = hiera('ec2_api_enabled', false),
   $ceilometer                  = hiera('ceilometer_api_enabled', false),
   $aodh                        = hiera('aodh_api_enabled', false),
   $panko                       = hiera('panko_api_enabled', false),
@@ -570,6 +588,8 @@ class tripleo::haproxy (
   $nova_placement_network      = hiera('nova_placement_network', undef),
   $panko_network               = hiera('panko_api_network', undef),
   $ovn_dbs_network             = hiera('ovn_dbs_network', undef),
+  $ec2_api_network             = hiera('ec2_api_network', undef),
+  $ec2_api_metadata_network    = hiera('ec2_api_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),
@@ -625,6 +645,9 @@ class tripleo::haproxy (
     panko_api_ssl_port => 13779,
     ovn_nbdb_port => 6641,
     ovn_sbdb_port => 6642,
+    ec2_api_port => 8788,
+    ec2_api_ssl_port => 13788,
+    ec2_api_metadata_port => 8789,
     sahara_api_port => 8386,
     sahara_api_ssl_port => 13386,
     swift_proxy_port => 8080,
@@ -998,6 +1021,34 @@ class tripleo::haproxy (
     }
   }
 
+  if $ec2_api {
+    ::tripleo::haproxy::endpoint { 'ec2_api':
+      public_virtual_ip => $public_virtual_ip,
+      internal_ip       => hiera('ec2_api_vip', $controller_virtual_ip),
+      service_port      => $ports[ec2_api_port],
+      ip_addresses      => hiera('ec2_api_node_ips', $controller_hosts_real),
+      server_names      => hiera('ec2_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[ec2_api_ssl_port],
+      service_network   => $ec2_api_network,
+    }
+  }
+
+  if $ec2_api_metadata {
+    ::tripleo::haproxy::endpoint { 'ec2_api_metadata':
+      internal_ip     => hiera('ec2_api_vip', $controller_virtual_ip),
+      service_port    => $ports[ec2_api_metadata_port],
+      ip_addresses    => hiera('ec2_api_node_ips', $controller_hosts_real),
+      server_names    => hiera('ec2_api_node_names', $controller_hosts_names_real),
+      service_network => $ec2_api_metadata_network,
+    }
+  }
+
   if $ceilometer {
     ::tripleo::haproxy::endpoint { 'ceilometer':
       public_virtual_ip => $public_virtual_ip,
index 1692108..5154464 100644 (file)
@@ -191,6 +191,9 @@ class tripleo::profile::base::database::mysql (
     if hiera('panko_api_enabled', false) {
       include ::panko::db::mysql
     }
+    if hiera('ec2_api_enabled', false) {
+      include ::ec2api::db::mysql
+    }
   }
 
 }
index a388def..a3a39e9 100644 (file)
@@ -255,6 +255,8 @@ class tripleo::profile::base::keystone (
       include ::zaqar::keystone::auth
       include ::zaqar::keystone::auth_websocket
     }
+    if hiera('ec2_api_enabled', false) {
+      include ::ec2api::keystone::auth
+    }
   }
 }
-
diff --git a/manifests/profile/base/nova/ec2api.pp b/manifests/profile/base/nova/ec2api.pp
new file mode 100644 (file)
index 0000000..f34b071
--- /dev/null
@@ -0,0 +1,35 @@
+# 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::nova::ec2api
+#
+# EC2-compatible Nova API profile for tripleo
+#
+# === Parameters
+#
+# [*step*]
+#   (Optional) The current step in deployment. See tripleo-heat-templates
+#   for more details.
+#   Defaults to hiera('step')
+#
+class tripleo::profile::base::nova::ec2api (
+  $step    = hiera('step')
+) {
+  if $step >= 4 {
+    include ::ec2api
+    include ::ec2api::api
+    include ::ec2api::db::sync
+    include ::ec2api::metadata
+  }
+}