support fuel 9.0

Change-Id: I77277731e7c59a94edd23c1bf3455110858afd27
This commit is contained in:
Alexey Chekunov 2016-08-17 17:56:21 +03:00
parent 98e1408da3
commit df3582597e
9 changed files with 89 additions and 198 deletions

View File

@ -1 +1,23 @@
include lbaas
# Copyright 2016 Mirantis, 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.
notice('MODULAR: neutron-lbaas')
$lbaas = hiera('lbaas', {})
$metadata = pick($lbaas['metadata'], {})
if $metadata['enabled']{
include lbaas
}

View File

@ -1,27 +0,0 @@
Puppet::Type.type(:neutron_config).provide(
:ini_setting,
:parent => Puppet::Type.type(:ini_setting).provider(:ruby)
) do
def section
resource[:name].split('/', 2).first
end
def setting
resource[:name].split('/', 2).last
end
def separator
'='
end
def self.file_path
'/etc/neutron/neutron.conf'
end
# added for backwards compatibility with older versions of inifile
def file_path
self.class.file_path
end
end

View File

@ -1,42 +0,0 @@
Puppet::Type.newtype(:neutron_config) do
ensurable
newparam(:name, :namevar => true) do
desc 'Section/setting name to manage from /etc/neutron/neutron.conf'
newvalues(/\S+\/\S+/)
end
newproperty(:value) do
desc 'The value of the setting to be defined.'
munge do |value|
value = value.to_s.strip
value.capitalize! if value =~ /^(true|false)$/i
value
end
def is_to_s( currentvalue )
if resource.secret?
return '[old secret redacted]'
else
return currentvalue
end
end
def should_to_s( newvalue )
if resource.secret?
return '[new secret redacted]'
else
return newvalue
end
end
end
newparam(:secret, :boolean => true) do
desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
newvalues(:true, :false)
defaultto false
end
end

View File

@ -1,40 +1,17 @@
# == Class: lbaas
# Copyright 2016 Mirantis, Inc.
#
# Full description of class lbaas here.
# 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
#
# === Parameters
#
# Document parameters here.
#
# [*sample_parameter*]
# Explanation of what this parameter affects and what it defaults to.
# e.g. "Specify one or more upstream ntp servers as an array."
#
# === Variables
#
# Here you should define a list of variables that this module would require.
#
# [*sample_variable*]
# Explanation of how this variable affects the funtion of this class and if
# it has a default. e.g. "The parameter enc_ntp_servers must be set by the
# External Node Classifier as a comma separated list of hostnames." (Note,
# global variables should be avoided in favor of class parameters as
# of Puppet 2.6.)
#
# === Examples
#
# class { 'lbaas':
# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
# }
#
# === Authors
#
# Author Name <author@domain.com>
#
# === Copyright
#
# Copyright 2014 Your name here, unless otherwise noted.
# 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 lbaas {
include lbaas::params
@ -42,54 +19,49 @@ class lbaas {
ensure => present,
}
# Actually, we need to define some resource, where we will do this configs and then we will call this resource from here. It need to better split
# configuration part (we will try that package with neutron is anstalled in that defined resource) and we can notify something from resource - e.g.
# we can create notify from that resource to neutron-server service. But now it good in that view.
# if $::osfamily == 'Debian'{
# neutron_config {
# "service_providers/service_provider": value => 'LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default';
# }
# }
neutron_config {
'service_providers/service_provider': value => $lbaas::params::lbaas_service_provider;
}
# Sorry, that needs to rework, obviously, but I haven't so much time to do it.
exec { "add_lbaas_plugin":
command => "/bin/sed -i \"/`egrep -v \'(^#|^$)\' $lbaas::params::neutron_conf_file | egrep \'.*service_plugins.*\'`/ s/$/,lbaas/\" $lbaas::params::neutron_conf_file",
unless => "/bin/egrep -v '(^#|^$)' $lbaas::params::neutron_conf_file | egrep '.*service_plugins.*lbaas.*'",
notify => Service['neutron-server']
ini_subsetting {'enable_lbaas_plugin':
ensure => present,
section => 'DEFAULT',
key_val_separator => '=',
path => $lbaas::params::neutron_conf_file,
setting => 'service_plugins',
subsetting => $lbaas::params::lbaas_service_plugin_name,
subsetting_separator => ',',
}
lbaas_config {
"DEFAULT/device_driver": value => 'neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver';
"DEFAULT/interface_driver": value => 'neutron.agent.linux.interface.OVSInterfaceDriver';
"haproxy/user_group": value => $lbaas::params::usergroup;
'DEFAULT/interface_driver': value => 'openvswitch';
}
# That too should be redesigned, but I'm not sure that I need to write whole new provider to change one string of code.
exec { "enable_lbaas":
command => "/bin/sed -i \"s/'enable_lb': False/'enable_lb': True/\" $lbaas::params::horizon_settings_file",
unless => "/bin/egrep \"'enable_lb': True\" $lbaas::params::horizon_settings_file",
notify => Service[$lbaas::params::httpd_service_name],
exec { 'neutron-db-sync':
command => 'neutron-db-manage --subproject neutron-lbaas upgrade head',
path => '/usr/bin',
logoutput => on_failure,
require => Package[$lbaas::params::lbaas_package_name],
}
Neutron_config<||> ~> Service<| tag == 'lbaas-service' |>
Ini_subsetting<||> ~> Service<| tag == 'lbaas-service' |>
Lbaas_config<||> ~> Service<| tag == 'lbaas-service' |>
service { 'neutron-server':
ensure => running,
enable => true,
require => Package[$lbaas::params::lbaas_package_name],
ensure => running,
enable => true,
tag => 'lbaas-service',
hasstatus => true,
hasrestart => true,
require => Exec['neutron-db-sync'],
}
service { 'neutron-lbaas-agent':
service { $lbaas::params::lbaas_service_name:
ensure => running,
enable => true,
require => Package[$lbaas::params::lbaas_package_name],
}
package { $lbaas::params::haproxy_pkg:
ensure => present,
}
service { $lbaas::params::httpd_service_name:
enable => true,
ensure => running,
tag => 'lbaas-service',
require => Exec['neutron-db-sync'],
}
}

View File

@ -1,21 +1,10 @@
#Class lbaas::params
class lbaas::params {
$neutron_conf_file = '/etc/neutron/neutron.conf'
$lbaas_conf_file = '/etc/neutron/lbaas_agent.ini'
$haproxy_pkg = 'haproxy'
$neutron_conf_file = '/etc/neutron/neutron.conf'
$lbaas_conf_file = '/etc/neutron/lbaas_agent.ini'
$lbaas_package_name = 'neutron-lbaasv2-agent'
$lbaas_service_name = 'neutron-lbaasv2-agent'
$lbaas_service_plugin_name = 'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2'
$lbaas_service_provider = 'LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default'
if $::osfamily == 'Debian' {
$httpd_service_name = 'apache2'
$horizon_settings_file = '/etc/openstack-dashboard/local_settings.py'
$lbaas_package_name = 'neutron-lbaas-agent'
$usergroup = 'nogroup'
} elsif($::osfamily == 'RedHat') {
$httpd_service_name = 'httpd'
$horizon_settings_file = '/etc/openstack-dashboard/local_settings'
$lbaas_package_name = 'openstack-neutron'
$usergroup = 'nobody'
} else {
fail("unsupported family ${::osfamily}")
}
}

11
deployment_tasks.yaml Normal file
View File

@ -0,0 +1,11 @@
- id: deploy-lbbas-service
type: puppet
version: 2.0.0
groups: [primary-controller, controller]
requires: [deploy_start, openstack-network-end]
required_for: [deploy_end]
parameters:
puppet_manifest: puppet/manifests/site.pp
puppet_modules: puppet/modules:/etc/puppet/modules
timeout: 360

View File

@ -1,33 +1,19 @@
name: lbaas
title: LBaaS plugin for Neutron
version: 1.0.2
version: 1.0.3
description: Enables LBaaS for Neutron. Be aware, in HA mode rescheduling of LB instances will not work!!
fuel_version: ['6.1']
fuel_version: ['9.0']
licenses: ['Apache License Version 2.0']
authors: ['Stanislaw Bogatkin']
authors: ['Stanislaw Bogatkin, Aleksei Chekunov']
homepage: 'https://github.com/stackforge/fuel-plugin-neutron-lbaas'
groups: ['network']
is_hotpluggable: true
releases:
- os: ubuntu
version: 2014.2-6.0
version: mitaka-9.0
mode: ['multinode','ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2014.2-6.0
mode: ['multinode','ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
- os: ubuntu
version: 2014.2-6.1
mode: ['multinode','ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/ubuntu
- os: centos
version: 2014.2-6.1
mode: ['multinode','ha']
deployment_scripts_path: deployment_scripts/
repository_path: repositories/centos
package_version: '2.0.0'
package_version: '3.0.0'

View File

@ -1,14 +1,2 @@
#!/bin/bash
set -eux
ROOT="$(dirname `readlink -f $0`)"
MODULES="${ROOT}"/deployment_scripts/puppet/modules/
TMP_DIR="${ROOT}"/tmp
mkdir -p "${MODULES}"
mkdir -p "${TMP_DIR}"
REPO_PATH='https://github.com/stackforge/fuel-library/tarball/f43d885914d74fbd062096763222f350f47480e1'
wget -qO- "${REPO_PATH}" | \
tar -C "${MODULES}" --strip-components=3 -zxvf - \
stackforge-fuel-library-f43d885/deployment/puppet/inifile
# all operations should be inside plugin's folder

View File

@ -1,8 +0,0 @@
# Deployment is required for controllers
- role: ['primary-controller', 'controller']
stage: post_deployment
type: puppet
parameters:
puppet_manifest: puppet/manifests/site.pp
puppet_modules: puppet/modules
timeout: 360