Updates for Train
Deprecated: - LBaaS has been removed as it's been deprecated upstream [1] Changed: - Update release to train Fixed: - Cookstyle Removed: - Unused .rubocop.yml [1] https://docs.openstack.org/releasenotes/neutron/train.html#relnotes-15-0-0-stable-train-deprecation-notes Change-Id: I4c7f58ea60c02704877531fe3e7849c47aacf7ae Depends-On: https://review.opendev.org/731859changes/61/731861/2
parent
cb26946e73
commit
dac0c7c8d4
14
.rubocop.yml
14
.rubocop.yml
|
@ -1,14 +0,0 @@
|
|||
AllCops:
|
||||
Include:
|
||||
- metadata.rb
|
||||
- Gemfile
|
||||
- attributes/**
|
||||
- libraries/**
|
||||
- providers/**
|
||||
- recipes/**
|
||||
- resources/**
|
||||
- spec/**
|
||||
Exclude:
|
||||
- .cookbooks/**/*
|
||||
- berks-cookbooks/**/*
|
||||
- .bundle/**/*
|
18
README.rst
18
README.rst
|
@ -26,7 +26,7 @@ Requirements
|
|||
============
|
||||
|
||||
- Chef 15 or higher
|
||||
- Chef Workstation 0.15.18 for testing (also includes Berkshelf for
|
||||
- Chef Workstation 0.18.3 for testing (also includes Berkshelf for
|
||||
cookbook dependency resolution)
|
||||
|
||||
Platform
|
||||
|
@ -42,8 +42,8 @@ Cookbooks
|
|||
The following cookbooks are dependencies:
|
||||
|
||||
- 'openstackclient'
|
||||
- 'openstack-common', '>= 19.0.0'
|
||||
- 'openstack-identity', '>= 19.0.0'
|
||||
- 'openstack-common', '>= 20.0.0'
|
||||
- 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
Attributes
|
||||
==========
|
||||
|
@ -105,18 +105,6 @@ attributes in using the same template as for the ``neutron.conf``
|
|||
|
||||
node['openstack']['network_l3']['conf']
|
||||
|
||||
openstack-network::lbaas
|
||||
------------------------
|
||||
|
||||
- Installs the Loadbalancer as a Service
|
||||
|
||||
The configuration for ``neutron-lbaas-agent`` is generated from the
|
||||
attributes in using the same template as for the ``neutron.conf``
|
||||
|
||||
.. code-block:: ruby
|
||||
|
||||
node['openstack']['network_lbaas']['conf']
|
||||
|
||||
openstack-network::metadata_agent
|
||||
---------------------------------
|
||||
|
||||
|
|
|
@ -51,7 +51,7 @@ default['openstack']['network']['service_type'] = 'network'
|
|||
default['openstack']['network']['description'] = 'OpenStack Networking service'
|
||||
default['openstack']['network']['rabbit_server_chef_role'] = 'rabbitmq-server'
|
||||
# The bridging interface driver.
|
||||
# This is used by the L3, DHCP and LBaaS agents.
|
||||
# This is used by the L3 and DHCP agents.
|
||||
# Options are:
|
||||
#
|
||||
# - neutron.agent.linux.interface.OVSInterfaceDriver
|
||||
|
@ -132,43 +132,12 @@ default['openstack']['network_metering']['conf'].tap do |conf|
|
|||
conf['DEFAULT']['driver'] = 'neutron.services.metering.drivers.iptables.iptables_driver.IptablesMeteringDriver'
|
||||
end
|
||||
|
||||
# ============================= LBaaS Agent Configuration ==================
|
||||
# To enable 'lbaas' as service_plugin, you need to add it to neutron.conf
|
||||
# ['default']['service_plugins']
|
||||
# Set to true to enable lbaas
|
||||
default['openstack']['network_lbaas']['enabled'] = false
|
||||
# Custom the lbaas neutron config file path
|
||||
default['openstack']['network_lbaas']['config_file'] =
|
||||
case node['platform_family']
|
||||
when 'rhel'
|
||||
'/etc/neutron/neutron_lbaas.conf'
|
||||
when 'debian'
|
||||
'/etc/neutron/conf.d/neutron-server/neutron_lbaas.conf'
|
||||
end
|
||||
default['openstack']['network_lbaas']['conf'].tap do |conf|
|
||||
conf['service_providers']['service_provider'] =
|
||||
'LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default'
|
||||
end
|
||||
# Custom the lbaas agent config file path
|
||||
default['openstack']['network_lbaas_agent']['config_file'] = '/etc/neutron/lbaas_agent.ini'
|
||||
default['openstack']['network_lbaas_agent']['conf'].tap do |conf|
|
||||
conf['DEFAULT']['interface_driver'] = 'openvswitch'
|
||||
conf['DEFAULT']['device_driver'] = 'neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver'
|
||||
case node['platform_family']
|
||||
when 'fedora', 'rhel'
|
||||
conf['haproxy']['user_group'] = 'nobody'
|
||||
when 'debian'
|
||||
conf['haproxy']['user_group'] = 'nogroup'
|
||||
end
|
||||
end
|
||||
|
||||
# ============================= platform-specific settings ===========
|
||||
default['openstack']['network']['platform'].tap do |platform|
|
||||
platform['user'] = 'neutron'
|
||||
platform['group'] = 'neutron'
|
||||
platform['neutron_dhcp_agent_service'] = 'neutron-dhcp-agent'
|
||||
platform['neutron_l3_agent_service'] = 'neutron-l3-agent'
|
||||
platform['neutron_lb_agent_service'] = 'neutron-lbaasv2-agent'
|
||||
platform['neutron_metadata_agent_service'] = 'neutron-metadata-agent'
|
||||
platform['neutron_metering_agent_service'] = 'neutron-metering-agent'
|
||||
platform['neutron_server_service'] = 'neutron-server'
|
||||
|
@ -191,13 +160,6 @@ default['openstack']['network']['platform'].tap do |platform|
|
|||
radvd
|
||||
)
|
||||
platform['neutron_plugin_package'] = 'neutron-plugin-ml2'
|
||||
platform['neutron_lbaas_packages'] =
|
||||
%w(
|
||||
haproxy
|
||||
iproute
|
||||
openstack-neutron-lbaas
|
||||
)
|
||||
platform['neutron_lbaas_python_dependencies'] = %w(python-neutron-lbaas)
|
||||
platform['neutron_openvswitch_packages'] = %w(openvswitch)
|
||||
platform['neutron_openvswitch_agent_packages'] = %w(openstack-neutron-openvswitch iproute)
|
||||
platform['neutron_linuxbridge_agent_packages'] = %w(openstack-neutron-linuxbridge iproute)
|
||||
|
@ -217,14 +179,6 @@ default['openstack']['network']['platform'].tap do |platform|
|
|||
neutron-l3-agent
|
||||
radvd
|
||||
)
|
||||
platform['neutron_lbaas_packages'] =
|
||||
%w(
|
||||
haproxy
|
||||
neutron-lbaas-common
|
||||
neutron-lbaasv2-agent
|
||||
python3-neutron-lbaas
|
||||
)
|
||||
platform['neutron_lbaas_python_dependencies'] = %w(python3-neutron-lbaas)
|
||||
platform['neutron_openvswitch_packages'] = %w(openvswitch-switch bridge-utils)
|
||||
platform['neutron_openvswitch_build_packages'] =
|
||||
%w(
|
||||
|
|
|
@ -11,17 +11,6 @@ default['openstack']['network']['conf'].tap do |conf|
|
|||
end
|
||||
conf['DEFAULT']['control_exchange'] = 'neutron'
|
||||
conf['DEFAULT']['core_plugin'] = 'ml2'
|
||||
if node['openstack']['network_lbaas']['enabled']
|
||||
conf['DEFAULT']['service_plugins'] =
|
||||
if conf['DEFAULT']['service_plugins'].empty?
|
||||
'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2'
|
||||
else
|
||||
[
|
||||
'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2',
|
||||
conf['DEFAULT']['service_plugins'],
|
||||
].flatten.sort.join(',')
|
||||
end
|
||||
end
|
||||
|
||||
# [agent] section
|
||||
if node['openstack']['network']['use_rootwrap']
|
||||
|
|
|
@ -3,15 +3,15 @@ maintainer 'openstack-chef'
|
|||
maintainer_email 'openstack-discuss@lists.openstack.org'
|
||||
license 'Apache-2.0'
|
||||
description 'Installs and configures the OpenStack Network API Service and various agents and plugins'
|
||||
version '19.0.0'
|
||||
version '20.0.0'
|
||||
|
||||
%w(ubuntu redhat centos).each do |os|
|
||||
supports os
|
||||
end
|
||||
|
||||
depends 'openstackclient'
|
||||
depends 'openstack-common', '>= 19.0.0'
|
||||
depends 'openstack-identity', '>= 19.0.0'
|
||||
depends 'openstack-common', '>= 20.0.0'
|
||||
depends 'openstack-identity', '>= 20.0.0'
|
||||
|
||||
issues_url 'https://launchpad.net/openstack-chef'
|
||||
source_url 'https://opendev.org/openstack/cookbook-openstack-network'
|
||||
|
|
|
@ -19,21 +19,10 @@
|
|||
# limitations under the License.
|
||||
#
|
||||
|
||||
plugin_config_file = node['openstack']['network']['core_plugin_config_file']
|
||||
timeout = node['openstack']['network']['dbsync_timeout']
|
||||
# The node['openstack']['network']['plugin_config_file'] attribute is set in the default.rb recipe
|
||||
execute 'migrate network database' do
|
||||
timeout timeout
|
||||
timeout node['openstack']['network']['dbsync_timeout']
|
||||
command <<-EOF.gsub(/^ {4}/, '')
|
||||
neutron-db-manage --config-file /etc/neutron/neutron.conf upgrade head
|
||||
EOF
|
||||
end
|
||||
|
||||
# Only if the lbaas is enabled, migrate the database.
|
||||
execute 'migrate lbaas database' do
|
||||
timeout timeout
|
||||
command <<-EOF.gsub(/^ {4}/, '')
|
||||
neutron-db-manage --subproject neutron-lbaas --config-file /etc/neutron/neutron.conf --config-file #{plugin_config_file} upgrade head
|
||||
EOF
|
||||
only_if { node['openstack']['network_lbaas']['enabled'] }
|
||||
end
|
||||
|
|
|
@ -1,74 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
#
|
||||
# Cookbook:: openstack-network
|
||||
# Recipe:: lbaas
|
||||
#
|
||||
# Copyright:: 2013, Mirantis IT
|
||||
# Copyright:: 2020, Oregon State University
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# This recipe should be placed in the run_list of the node that
|
||||
# runs the network server or network controller server.
|
||||
include_recipe 'openstack-network'
|
||||
|
||||
# Make Openstack object available in Chef::Recipe
|
||||
class ::Chef::Recipe
|
||||
include ::Openstack
|
||||
end
|
||||
|
||||
platform_options = node['openstack']['network']['platform']
|
||||
package platform_options['neutron_lbaas_packages'] do
|
||||
options platform_options['package_overrides']
|
||||
action :upgrade
|
||||
end
|
||||
|
||||
neutron_config = merge_config_options 'network_lbaas'
|
||||
agent_config = merge_config_options 'network_lbaas_agent'
|
||||
|
||||
directory '/etc/neutron/conf.d/neutron-server' do
|
||||
recursive true
|
||||
only_if { platform_family?('debian') }
|
||||
end
|
||||
|
||||
template node['openstack']['network_lbaas']['config_file'] do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['network']['platform']['user']
|
||||
group node['openstack']['network']['platform']['group']
|
||||
mode '640'
|
||||
variables(
|
||||
service_config: neutron_config
|
||||
)
|
||||
notifies :restart, 'service[neutron-server]', :delayed
|
||||
end
|
||||
|
||||
template node['openstack']['network_lbaas_agent']['config_file'] do
|
||||
source 'openstack-service.conf.erb'
|
||||
cookbook 'openstack-common'
|
||||
owner node['openstack']['network']['platform']['user']
|
||||
group node['openstack']['network']['platform']['group']
|
||||
mode '640'
|
||||
variables(
|
||||
service_config: agent_config
|
||||
)
|
||||
notifies :restart, 'service[neutron-lb-agent]', :delayed
|
||||
end
|
||||
|
||||
service 'neutron-lb-agent' do
|
||||
service_name platform_options['neutron_lb_agent_service']
|
||||
supports status: true, restart: true
|
||||
action :enable
|
||||
subscribes :restart, 'template[/etc/neutron/neutron.conf]', :delayed
|
||||
subscribes :restart, "template[#{node['openstack']['network_lbaas']['config_file']}]", :delayed
|
||||
end
|
|
@ -60,21 +60,6 @@ if node['openstack']['network']['policyfile_url']
|
|||
end
|
||||
end
|
||||
|
||||
if node['openstack']['network_lbaas']['enabled']
|
||||
# neutron-lbaas-agent may not running on network node, but on network
|
||||
# node, neutron-server still need neutron_lbaas module when loading
|
||||
# plugin if lbaas is list in service_plugins. In this case, we don't
|
||||
# need include balance recipe for network node, but we need make sure
|
||||
# neutron lbaas python packages get installed on network node before
|
||||
# neutron-server start/restart, when lbaas is enabled. Otherwise
|
||||
# neutron-server will crash for couldn't find lbaas plugin when
|
||||
# invoking plugins from service_plugins.
|
||||
package platform_options['neutron_lbaas_python_dependencies'] do
|
||||
options platform_options['package_overrides']
|
||||
action :upgrade
|
||||
end
|
||||
end
|
||||
|
||||
# Migrate network database to latest version
|
||||
include_recipe 'openstack-network::db_migration'
|
||||
plugin_templates = []
|
||||
|
|
|
@ -29,28 +29,5 @@ describe 'openstack-network::db_migration' do
|
|||
)
|
||||
end
|
||||
end
|
||||
context 'run db-migration when services are enabled' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['network_lbaas']['enabled'] = true
|
||||
node.override['openstack']['network']['core_plugin_config_file'] = '/etc/neutron/plugins/ml2/ml2_conf.ini'
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
it 'uses db upgrade head when lbaas is enabled' do
|
||||
expect(chef_run).to run_execute('migrate lbaas database').with(
|
||||
command: "neutron-db-manage --subproject neutron-lbaas --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/ml2/ml2_conf.ini upgrade head\n",
|
||||
timeout: 3600
|
||||
)
|
||||
end
|
||||
end
|
||||
context 'run db-migration when services are enabled' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['network']['core_plugin_config_file'] = '/etc/neutron/plugins/ml2/ml2_conf.ini'
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
|
||||
it 'does not use db upgrade head when lbaas is not enabled' do
|
||||
expect(chef_run).not_to run_execute('migrate lbaas database')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -74,20 +74,6 @@ describe 'openstack-network' do
|
|||
end
|
||||
end
|
||||
|
||||
context 'lbaas enabled' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['network_lbaas']['enabled'] = true
|
||||
runner.converge(described_recipe)
|
||||
end
|
||||
[
|
||||
/^service_plugins = neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
[
|
||||
%r{^root_helper = sudo neutron-rootwrap /etc/neutron/rootwrap.conf$},
|
||||
].each do |line|
|
||||
|
|
|
@ -1,48 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-network::lbaas' do
|
||||
describe 'redhat' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(REDHAT_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['compute']['network']['service_type'] = 'neutron'
|
||||
node.override['openstack']['network']['lbaas']['enabled'] = 'True'
|
||||
runner.converge(described_recipe, 'openstack-network::ml2_core_plugin', 'openstack-network::server')
|
||||
end
|
||||
|
||||
include_context 'neutron-stubs'
|
||||
|
||||
it do
|
||||
expect(chef_run).to_not create_directory('/etc/neutron/conf.d/neutron-server')
|
||||
end
|
||||
|
||||
describe 'lbaas_agent.ini' do
|
||||
let(:file) { chef_run.template('/etc/neutron/lbaas_agent.ini') }
|
||||
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('haproxy', /^user_group = nobody$/)
|
||||
end
|
||||
end
|
||||
|
||||
pkgs =
|
||||
%w(
|
||||
haproxy
|
||||
iproute
|
||||
openstack-neutron-lbaas
|
||||
)
|
||||
it do
|
||||
expect(chef_run).to upgrade_package(pkgs)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to enable_service('neutron-lb-agent').with(
|
||||
service_name: 'neutron-lbaasv2-agent',
|
||||
supports: {
|
||||
status: true,
|
||||
restart: true,
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
|
@ -1,103 +0,0 @@
|
|||
# Encoding: utf-8
|
||||
require_relative 'spec_helper'
|
||||
|
||||
describe 'openstack-network::lbaas' do
|
||||
describe 'ubuntu' do
|
||||
let(:runner) { ChefSpec::SoloRunner.new(UBUNTU_OPTS) }
|
||||
let(:node) { runner.node }
|
||||
cached(:chef_run) do
|
||||
runner.converge(described_recipe, 'openstack-network::ml2_core_plugin', 'openstack-network::server')
|
||||
end
|
||||
|
||||
include_context 'neutron-stubs'
|
||||
|
||||
pkgs =
|
||||
%w(
|
||||
haproxy
|
||||
neutron-lbaas-common
|
||||
neutron-lbaasv2-agent
|
||||
python3-neutron-lbaas
|
||||
)
|
||||
it do
|
||||
expect(chef_run).to upgrade_package(pkgs)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(chef_run).to create_directory('/etc/neutron/conf.d/neutron-server').with(recursive: true)
|
||||
end
|
||||
|
||||
describe '/etc/neutron/lbaas_agent.ini' do
|
||||
let(:file) { chef_run.template('/etc/neutron/lbaas_agent.ini') }
|
||||
it do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
source: 'openstack-service.conf.erb',
|
||||
cookbook: 'openstack-common',
|
||||
user: 'neutron',
|
||||
group: 'neutron',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(file).to notify('service[neutron-lb-agent]').to(:restart)
|
||||
end
|
||||
|
||||
[
|
||||
/^interface_driver = openvswitch$/,
|
||||
/^device_driver = neutron_lbaas.drivers.haproxy.namespace_driver.HaproxyNSDriver$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('DEFAULT', line)
|
||||
end
|
||||
end
|
||||
[
|
||||
/^user_group = nogroup$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('haproxy', line)
|
||||
end
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to enable_service('neutron-lb-agent').with(
|
||||
service_name: 'neutron-lbaasv2-agent',
|
||||
supports: {
|
||||
status: true,
|
||||
restart: true,
|
||||
}
|
||||
)
|
||||
end
|
||||
%w(
|
||||
template[/etc/neutron/neutron.conf]
|
||||
template[/etc/neutron/conf.d/neutron-server/neutron_lbaas.conf]
|
||||
).each do |resource|
|
||||
it do
|
||||
expect(chef_run.service('neutron-lb-agent')).to subscribe_to(resource).on(:restart)
|
||||
end
|
||||
end
|
||||
end
|
||||
describe '/etc/neutron/conf.d/neutron-server/neutron_lbaas.conf' do
|
||||
let(:file) { chef_run.template('/etc/neutron/conf.d/neutron-server/neutron_lbaas.conf') }
|
||||
it do
|
||||
expect(chef_run).to create_template(file.name).with(
|
||||
source: 'openstack-service.conf.erb',
|
||||
cookbook: 'openstack-common',
|
||||
user: 'neutron',
|
||||
group: 'neutron',
|
||||
mode: '640'
|
||||
)
|
||||
end
|
||||
|
||||
it do
|
||||
expect(file).to notify('service[neutron-server]').to(:restart)
|
||||
end
|
||||
|
||||
[
|
||||
/^service_provider = LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default$/,
|
||||
].each do |line|
|
||||
it do
|
||||
expect(chef_run).to render_config_file(file.name).with_section_content('service_providers', line)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
|
@ -110,17 +110,6 @@ describe 'openstack-network::server' do
|
|||
%r{^NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini"$}
|
||||
)
|
||||
end
|
||||
context 'enable lbaas' do
|
||||
cached(:chef_run) do
|
||||
node.override['openstack']['network_lbaas']['enabled'] = true
|
||||
runner.converge('openstack-network::ml2_core_plugin', described_recipe)
|
||||
end
|
||||
it do
|
||||
expect(chef_run).to render_file(file.name).with_content(
|
||||
%r{^NEUTRON_PLUGIN_CONFIG="/etc/neutron/plugins/ml2/ml2_conf.ini --config-dir /etc/neutron/conf.d/neutron-server"$}
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -3,8 +3,4 @@
|
|||
|
||||
# path to config file corresponding to the core_plugin specified in
|
||||
# neutron.conf
|
||||
<% if node['openstack']['network_lbaas']['enabled'] -%>
|
||||
NEUTRON_PLUGIN_CONFIG="<%=@core_plugin_config%> --config-dir /etc/neutron/conf.d/neutron-server"
|
||||
<% else -%>
|
||||
NEUTRON_PLUGIN_CONFIG="<%=@core_plugin_config%>"
|
||||
<% end -%>
|
||||
|
|
Loading…
Reference in New Issue