diff options
-rw-r--r-- | controller-puppet.yaml | 52 | ||||
-rw-r--r-- | puppet/hieradata/common.yaml | 1 | ||||
-rw-r--r-- | puppet/hieradata/controller.yaml | 17 | ||||
-rw-r--r-- | puppet/hieradata/object.yaml | 11 | ||||
-rw-r--r-- | puppet/overcloud_controller.pp | 33 | ||||
-rw-r--r-- | puppet/ringbuilder.pp | 90 |
6 files changed, 201 insertions, 3 deletions
diff --git a/controller-puppet.yaml b/controller-puppet.yaml index 970df791..efb10fdd 100644 --- a/controller-puppet.yaml +++ b/controller-puppet.yaml @@ -528,6 +528,12 @@ resources: control_virtual_interface: {get_param: ControlVirtualInterface} public_virtual_interface: {get_param: PublicVirtualInterface} public_virtual_ip: {get_param: PublicVirtualIP} + swift_hash_suffix: {get_param: SwiftHashSuffix} + swift_password: {get_param: SwiftPassword} + swift_part_power: {get_param: SwiftPartPower} + swift_replicas: {get_param: SwiftReplicas} + swift_min_part_hours: {get_param: SwiftMinPartHours} + swift_mount_check: {get_param: SwiftMountCheck} # Map heat metadata into hiera datafiles @@ -540,18 +546,37 @@ resources: hierarchy: - heat_config_%{::deploy_config_name} - controller + - object - common datafiles: common: raw_data: {get_file: puppet/hieradata/common.yaml} + object: + raw_data: {get_file: puppet/hieradata/object.yaml} controller: raw_data: {get_file: puppet/hieradata/controller.yaml} oac_data: # data we map in from other OAC configurations bootstrap_nodeid: bootstrap_host.bootstrap_nodeid + # Swift + tripleo::ringbuilder::devices: swift.devices mapped_data: # data supplied directly to this deployment configuration, etc debug: {get_input: debug} bootstack_nodeid: {get_input: bootstack_nodeid} controller_host: {get_input: controller_host} #local-ipv4 + # Swift + swift::proxy::proxy_local_net_ip: {get_input: controller_host} + swift::proxy::authtoken::auth_host: {get_input: controller_virtual_ip} + swift::storage::all::storage_local_net_ip: {get_input: controller_host} + swift::swift_hash_suffix: {get_input: swift_hash_suffix} + swift::proxy::authtoken::admin_password: {get_input: swift_password} + tripleo::ringbuilder::part_power: {get_input: swift_part_power} + tripleo::ringbuilder::replicas: {get_input: swift_replicas} + tripleo::ringbuilder::min_part_hours: {get_input: swift_min_part_hours} + swift_mount_check: {get_input: swift_mount_check} + + # NOTE(dprince): build_ring support is currently not wired in. + # See: https://review.openstack.org/#/c/109225/ + tripleo::ringbuilder::build_ring: True # Cinder cinder_lvm_loop_device_size: {get_input: cinder_lvm_loop_device_size} cinder::volume::iscsi::iscsi_helper: {get_input: cinder_iscsi_helper} @@ -671,6 +696,7 @@ resources: tripleo::loadbalancer::nova_novncproxy: true tripleo::loadbalancer::mysql: true tripleo::loadbalancer::rabbitmq: true + tripleo::loadbalancer::swift_proxy_server: true # NOTE(dprince): this example uses a composition class # on the puppet side (loadbalancer.pp). This seemed like the @@ -710,10 +736,10 @@ resources: config: get_file: puppet/overcloud_controller.pp - # Step through a series of two more Puppet runs using the same manifest. + # Step through a series of Puppet runs using the same manifest. # NOTE(dprince): Heat breakpoints would make for a really cool way to step # through breakpoints in a controlled manner across the entire cluster - ControllerPuppetDeploymentTwo: + ControllerPuppetDeploymentServicesBase: type: OS::Heat::StructuredDeployment properties: name: puppet_2 @@ -723,11 +749,31 @@ resources: step: 1 actions: ['CREATE'] # no need for two passes on an UPDATE - ControllerPuppetDeploymentThree: + ControllerRingbuilderPuppetConfig: + type: OS::Heat::SoftwareConfig + properties: + group: puppet + options: + enable_hiera: True + enable_facter: False + inputs: + outputs: + - name: result + config: + get_file: puppet/ringbuilder.pp + + ControllerRingbuilderPuppetDeployment: type: OS::Heat::StructuredDeployment properties: name: puppet_3 server: {get_resource: Controller} + config: {get_resource: ControllerRingbuilderPuppetConfig} + + ControllerPuppetDeploymentOvercloudServices: + type: OS::Heat::StructuredDeployment + properties: + name: puppet_4 + server: {get_resource: Controller} config: {get_resource: ControllerPuppetConfig} input_values: step: 2 diff --git a/puppet/hieradata/common.yaml b/puppet/hieradata/common.yaml index 884be6af..76cde950 100644 --- a/puppet/hieradata/common.yaml +++ b/puppet/hieradata/common.yaml @@ -1 +1,2 @@ # Common Hiera data gets applied to all nodes +ssh::server::storeconfigs_enabled: false diff --git a/puppet/hieradata/controller.yaml b/puppet/hieradata/controller.yaml index 874d383b..99783a54 100644 --- a/puppet/hieradata/controller.yaml +++ b/puppet/hieradata/controller.yaml @@ -18,6 +18,23 @@ glance::registry::keystone_tenant: 'service' neutron::server::auth_tenant: 'service' neutron::agents::metadata::auth_tenant: 'service' cinder::api::keystone_tenant: 'service' +swift::proxy::authtoken::admin_tenant_name: 'service' + +#swift +swift::proxy::pipeline: + - 'catch_errors' + - 'healthcheck' + - 'cache' + - 'ratelimit' + - 'tempurl' + - 'formpost' + - 'staticweb' + - 'authtoken' + - 'keystone' + - 'proxy-logging' + - 'proxy-server' + +swift::proxy::account_autocreate: true # glance glance::api::pipeline: 'keystone' diff --git a/puppet/hieradata/object.yaml b/puppet/hieradata/object.yaml new file mode 100644 index 00000000..759a7ba9 --- /dev/null +++ b/puppet/hieradata/object.yaml @@ -0,0 +1,11 @@ +# Hiera data for swift storage nodes +swift::storage::all::object_pipeline: + - healthcheck + - recon + - object-server +swift::storage::all::container_pipeline: + - healthcheck + - container-server +swift::storage::all::account_pipeline: + - healthcheck + - account-server diff --git a/puppet/overcloud_controller.pp b/puppet/overcloud_controller.pp index 4c1306f2..b766dc50 100644 --- a/puppet/overcloud_controller.pp +++ b/puppet/overcloud_controller.pp @@ -117,6 +117,9 @@ if hiera('step') >= 1 { provider => 'rabbitmqctl', } + # pre-install swift here so we can build rings + include ::swift + } #END STEP 1 if hiera('step') >= 2 { @@ -206,4 +209,34 @@ if hiera('step') >= 2 { size => join([hiera('cinder_lvm_loop_device_size'), 'M']), } + # swift proxy + include ::memcached + include ::swift::proxy + include ::swift::proxy::proxy_logging + include ::swift::proxy::healthcheck + include ::swift::proxy::cache + include ::swift::proxy::keystone + include ::swift::proxy::authtoken + include ::swift::proxy::staticweb + include ::swift::proxy::ratelimit + include ::swift::proxy::catch_errors + include ::swift::proxy::tempurl + include ::swift::proxy::formpost + + # swift storage + class {'swift::storage::all': + mount_check => str2bool(hiera('swift_mount_check')) + } + if(!defined(File['/srv/node'])) { + file { '/srv/node': + ensure => directory, + owner => 'swift', + group => 'swift', + require => Package['openstack-swift'], + } + } + $swift_components = ['account', 'container', 'object'] + swift::storage::filter::recon { $swift_components : } + swift::storage::filter::healthcheck { $swift_components : } + } #END STEP 2 diff --git a/puppet/ringbuilder.pp b/puppet/ringbuilder.pp new file mode 100644 index 00000000..85f7eea5 --- /dev/null +++ b/puppet/ringbuilder.pp @@ -0,0 +1,90 @@ +# Copyright 2015 Red Hat, Inc. +# All Rights Reserved. +# +# 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. + +define add_devices( + $swift_zones = '1' +){ + + # NOTE(dprince): Swift zones is not yet properly wired into the Heat + # templates. See: https://review.openstack.org/#/c/97758/3 + # For now our regex supports the r1z1-192.0.2.6:%PORT%/d1 syntax or the + # newer r1z%<controller or SwiftStorage><N>%-192.0.2.6:%PORT%/d1 syntax. + $server_num_or_device = regsubst($name,'^r1z%+[A-Za-z]*([0-9]+)%+-(.*)$','\1') + if (is_integer($server_num_or_device)) { + $server_num = $server_num_or_device + } else { + $server_num = '1' + } + # Function to place server in its zone. Zone is calculated by + # server number in heat template modulo the number of zones + 1. + $zone = (($server_num%$swift_zones) + 1) + + # add the rings + $base = regsubst($name,'^r1.*-(.*)$','\1') + $object = regsubst($base, '%PORT%', '6000') + ring_object_device { $object: + zone => '1', + weight => 100, + } + $container = regsubst($base, '%PORT%', '6001') + ring_container_device { $container: + zone => '1', + weight => 100, + } + $account = regsubst($base, '%PORT%', '6002') + ring_account_device { $account: + zone => '1', + weight => 100, + } +} + +class tripleo::ringbuilder ( + $swift_zones = '1', + $devices = '', + $build_ring = 'True', + $part_power, + $replicas, + $min_part_hours, +) { + + if str2bool(downcase("$build_ring")) { + + $device_array = strip(split(rstrip($devices), ',')) + + # create local rings + swift::ringbuilder::create{ ['object', 'account', 'container']: + part_power => $part_power, + replicas => $replicas, + min_part_hours => $min_part_hours, + } -> + + # add all other devices + add_devices {$device_array: + swift_zones => $swift_zones + } -> + + # rebalance + swift::ringbuilder::rebalance{ ['object', 'account', 'container']: + seed => 999, + } + + Ring_object_device<| |> ~> Exec['rebalance_object'] + Ring_object_device<| |> ~> Exec['rebalance_account'] + Ring_object_device<| |> ~> Exec['rebalance_container'] + + } +} + +include ::tripleo::ringbuilder |