Deploy Loadbalancer as a composable role
authorEmilien Macchi <emilien@redhat.com>
Thu, 5 May 2016 15:46:51 +0000 (11:46 -0400)
committerEmilien Macchi <emilien@redhat.com>
Thu, 19 May 2016 09:16:25 +0000 (11:16 +0200)
Deploy loadbalancer service using puppet-tripleo, and drop puppet code.

Implements: blueprint refactor-puppet-manifests
Depends-On: I9b106dcc1a4d446ab5dea8430ed295e6ec209cbd

Change-Id: I9ca50a4bc822ec17d89988894af9bdf07e4bd1a9

environments/puppet-pacemaker.yaml
overcloud-resource-registry-puppet.yaml
overcloud.yaml
puppet/manifests/overcloud_controller.pp
puppet/manifests/overcloud_controller_pacemaker.pp
puppet/services/loadbalancer.yaml [new file with mode: 0644]
puppet/services/pacemaker/loadbalancer.yaml [new file with mode: 0644]

index 61ad24b..4dede42 100644 (file)
@@ -16,3 +16,4 @@ resource_registry:
   OS::TripleO::Services::NeutronL3Agent: ../puppet/services/pacemaker/neutron-l3.yaml
   OS::TripleO::Services::NeutronMetadataAgent: ../puppet/services/pacemaker/neutron-metadata.yaml
   OS::TripleO::Services::RabbitMQ: ../puppet/services/pacemaker/rabbitmq.yaml
+  OS::TripleO::Services::Loadbalancer: ../puppet/services/pacemaker/loadbalancer.yaml
index e358f17..55ce7c3 100644 (file)
@@ -130,6 +130,7 @@ resource_registry:
   OS::TripleO::Services::NeutronL3Agent: puppet/services/neutron-l3.yaml
   OS::TripleO::Services::NeutronMetadataAgent: puppet/services/neutron-metadata.yaml
   OS::TripleO::Services::RabbitMQ: puppet/services/rabbitmq.yaml
+  OS::TripleO::Services::Loadbalancer: puppet/services/loadbalancer.yaml
 
 parameter_defaults:
   EnablePackageInstall: false
index 6b5f6ed..71a544f 100644 (file)
@@ -658,6 +658,7 @@ parameters:
       - OS::TripleO::Services::NeutronL3Agent
       - OS::TripleO::Services::NeutronMetadataAgent
       - OS::TripleO::Services::RabbitMQ
+      - OS::TripleO::Services::Loadbalancer
     description: A list of service resources (configured in the Heat
                  resource_registry) which represent nested stacks
                  for each service that should get installed on the Controllers.
index 6c2716a..833a3e0 100644 (file)
@@ -24,15 +24,6 @@ if hiera('step') >= 1 {
   create_resources(sysctl::value, hiera('sysctl_settings'), {})
   Exec <| tag == 'kmod::load' |>  -> Sysctl <| |>
 
-  $controller_node_ips = split(hiera('controller_node_ips'), ',')
-
-  if $enable_load_balancer {
-    class { '::tripleo::loadbalancer' :
-      controller_hosts => $controller_node_ips,
-      manage_vip       => true,
-    }
-  }
-
 }
 
 if hiera('step') >= 2 {
index 5c6e15a..9159366 100644 (file)
@@ -66,18 +66,6 @@ if hiera('step') >= 1 {
     include ::ntp
   }
 
-  $controller_node_ips = split(hiera('controller_node_ips'), ',')
-  $controller_node_names = split(downcase(hiera('controller_node_names')), ',')
-  if $enable_load_balancer {
-    class { '::tripleo::loadbalancer' :
-      controller_hosts       => $controller_node_ips,
-      controller_hosts_names => $controller_node_names,
-      manage_vip             => false,
-      mysql_clustercheck     => true,
-      haproxy_service_manage => false,
-    }
-  }
-
   $pacemaker_cluster_members = downcase(regsubst(hiera('controller_node_names'), ',', ' ', 'G'))
   $corosync_ipv6 = str2bool(hiera('corosync_ipv6', false))
   if $corosync_ipv6 {
@@ -210,64 +198,12 @@ if hiera('step') >= 2 {
 
   if $pacemaker_master {
 
-    if $enable_load_balancer {
-
-      include ::pacemaker::resource_defaults
-
-      # Create an openstack-core dummy resource. See RHBZ 1290121
-      pacemaker::resource::ocf { 'openstack-core':
-        ocf_agent_name => 'heartbeat:Dummy',
-        clone_params   => true,
-      }
-      # FIXME: we should not have to access tripleo::loadbalancer class
-      # parameters here to configure pacemaker VIPs. The configuration
-      # of pacemaker VIPs could move into puppet-tripleo or we should
-      # make use of less specific hiera parameters here for the settings.
-      pacemaker::resource::service { 'haproxy':
-        clone_params => true,
-      }
-
-      $control_vip = hiera('tripleo::loadbalancer::controller_virtual_ip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_control_vip':
-        vip_name   => 'control',
-        ip_address => $control_vip,
-      }
-
-      $public_vip = hiera('tripleo::loadbalancer::public_virtual_ip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_public_vip':
-        ensure     => $public_vip and $public_vip != $control_vip,
-        vip_name   => 'public',
-        ip_address => $public_vip,
-      }
-
-      $redis_vip = hiera('redis_vip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_redis_vip':
-        ensure     => $redis_vip and $redis_vip != $control_vip,
-        vip_name   => 'redis',
-        ip_address => $redis_vip,
-      }
-
+    include ::pacemaker::resource_defaults
 
-      $internal_api_vip = hiera('tripleo::loadbalancer::internal_api_virtual_ip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_internal_api_vip':
-        ensure     => $internal_api_vip and $internal_api_vip != $control_vip,
-        vip_name   => 'internal_api',
-        ip_address => $internal_api_vip,
-      }
-
-      $storage_vip = hiera('tripleo::loadbalancer::storage_virtual_ip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_vip':
-        ensure     => $storage_vip and $storage_vip != $control_vip,
-        vip_name   => 'storage',
-        ip_address => $storage_vip,
-      }
-
-      $storage_mgmt_vip = hiera('tripleo::loadbalancer::storage_mgmt_virtual_ip')
-      tripleo::pacemaker::haproxy_with_vip { 'haproxy_and_storage_mgmt_vip':
-        ensure     => $storage_mgmt_vip and $storage_mgmt_vip != $control_vip,
-        vip_name   => 'storage_mgmt',
-        ip_address => $storage_mgmt_vip,
-      }
+    # Create an openstack-core dummy resource. See RHBZ 1290121
+    pacemaker::resource::ocf { 'openstack-core':
+      ocf_agent_name => 'heartbeat:Dummy',
+      clone_params   => true,
     }
 
     pacemaker::resource::service { $::memcached::params::service_name :
diff --git a/puppet/services/loadbalancer.yaml b/puppet/services/loadbalancer.yaml
new file mode 100644 (file)
index 0000000..0c1757b
--- /dev/null
@@ -0,0 +1,21 @@
+heat_template_version: 2016-04-08
+
+description: >
+  Loadbalancer service configured with Puppet
+
+parameters:
+  EndpointMap:
+    default: {}
+    description: Mapping of service endpoint -> protocol. Typically set
+                 via parameter_defaults in the resource registry.
+    type: json
+  MysqlVirtualIPUri:
+    type: string
+    default: ''
+
+outputs:
+  role_data:
+    description: Role data for the Loadbalancer role.
+    value:
+      step_config: |
+        include ::tripleo::profile::base::loadbalancer
diff --git a/puppet/services/pacemaker/loadbalancer.yaml b/puppet/services/pacemaker/loadbalancer.yaml
new file mode 100644 (file)
index 0000000..771b3d9
--- /dev/null
@@ -0,0 +1,34 @@
+heat_template_version: 2016-04-08
+
+description: >
+  Loadbalancer service with Pacemaker configured with Puppet
+
+parameters:
+  EndpointMap:
+    default: {}
+    description: Mapping of service endpoint -> protocol. Typically set
+                 via parameter_defaults in the resource registry.
+    type: json
+  MysqlVirtualIPUri:
+    type: string
+    default: ''
+
+resources:
+  LoadbalancerServiceBase:
+    type: ../loadbalancer.yaml
+    properties:
+      EndpointMap: {get_param: EndpointMap}
+      MysqlVirtualIPUri: {get_param: MysqlVirtualIPUri}
+
+outputs:
+  role_data:
+    description: Role data for the Loadbalancer pacemaker role.
+    value:
+      config_settings:
+        map_merge:
+          - get_attr: [LoadbalancerServiceBase, role_data, config_settings]
+          - tripleo::loadbalancer::haproxy_service_manage: false
+            tripleo::loadbalancer::mysql_clustercheck: true
+            tripleo::loadbalancer::manage_vip: false
+      step_config: |
+        include ::tripleo::profile::pacemaker::loadbalancer