Browse Source

support fuel 9.0

Change-Id: I77277731e7c59a94edd23c1bf3455110858afd27
Alexey Chekunov 2 years ago
parent
commit
df3582597e

+ 23
- 1
deployment_scripts/puppet/manifests/site.pp View File

@@ -1 +1,23 @@
1
-include lbaas
1
+#    Copyright 2016 Mirantis, Inc.
2
+#
3
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+#    not use this file except in compliance with the License. You may obtain
5
+#    a copy of the License at
6
+#
7
+#         http://www.apache.org/licenses/LICENSE-2.0
8
+#
9
+#    Unless required by applicable law or agreed to in writing, software
10
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+#    License for the specific language governing permissions and limitations
13
+#    under the License.
14
+
15
+notice('MODULAR: neutron-lbaas')
16
+
17
+$lbaas = hiera('lbaas', {})
18
+$metadata = pick($lbaas['metadata'], {})
19
+
20
+if $metadata['enabled']{
21
+
22
+  include lbaas
23
+}

+ 0
- 27
deployment_scripts/puppet/modules/lbaas/lib/puppet/provider/neutron_config/ini_setting.rb View File

@@ -1,27 +0,0 @@
1
-Puppet::Type.type(:neutron_config).provide(
2
-  :ini_setting,
3
-  :parent => Puppet::Type.type(:ini_setting).provider(:ruby)
4
-) do
5
-
6
-  def section
7
-    resource[:name].split('/', 2).first
8
-  end
9
-
10
-  def setting
11
-    resource[:name].split('/', 2).last
12
-  end
13
-
14
-  def separator
15
-    '='
16
-  end
17
-
18
-  def self.file_path
19
-    '/etc/neutron/neutron.conf'
20
-  end
21
-
22
-  # added for backwards compatibility with older versions of inifile
23
-  def file_path
24
-    self.class.file_path
25
-  end
26
-
27
-end

+ 0
- 42
deployment_scripts/puppet/modules/lbaas/lib/puppet/type/neutron_config.rb View File

@@ -1,42 +0,0 @@
1
-Puppet::Type.newtype(:neutron_config) do
2
-
3
-  ensurable
4
-
5
-  newparam(:name, :namevar => true) do
6
-    desc 'Section/setting name to manage from /etc/neutron/neutron.conf'
7
-    newvalues(/\S+\/\S+/)
8
-  end
9
-
10
-  newproperty(:value) do
11
-    desc 'The value of the setting to be defined.'
12
-    munge do |value|
13
-      value = value.to_s.strip
14
-      value.capitalize! if value =~ /^(true|false)$/i
15
-      value
16
-    end
17
-
18
-    def is_to_s( currentvalue )
19
-      if resource.secret?
20
-        return '[old secret redacted]'
21
-      else
22
-        return currentvalue
23
-      end
24
-    end
25
-
26
-    def should_to_s( newvalue )
27
-      if resource.secret?
28
-        return '[new secret redacted]'
29
-      else
30
-        return newvalue
31
-      end
32
-    end
33
-  end
34
-
35
-  newparam(:secret, :boolean => true) do
36
-    desc 'Whether to hide the value from Puppet logs. Defaults to `false`.'
37
-
38
-    newvalues(:true, :false)
39
-
40
-    defaultto false
41
-  end
42
-end

+ 41
- 69
deployment_scripts/puppet/modules/lbaas/manifests/init.pp View File

@@ -1,40 +1,17 @@
1
-# == Class: lbaas
1
+#    Copyright 2016 Mirantis, Inc.
2 2
 #
3
-# Full description of class lbaas here.
3
+#    Licensed under the Apache License, Version 2.0 (the "License"); you may
4
+#    not use this file except in compliance with the License. You may obtain
5
+#    a copy of the License at
4 6
 #
5
-# === Parameters
6
-#
7
-# Document parameters here.
8
-#
9
-# [*sample_parameter*]
10
-#   Explanation of what this parameter affects and what it defaults to.
11
-#   e.g. "Specify one or more upstream ntp servers as an array."
12
-#
13
-# === Variables
14
-#
15
-# Here you should define a list of variables that this module would require.
16
-#
17
-# [*sample_variable*]
18
-#   Explanation of how this variable affects the funtion of this class and if
19
-#   it has a default. e.g. "The parameter enc_ntp_servers must be set by the
20
-#   External Node Classifier as a comma separated list of hostnames." (Note,
21
-#   global variables should be avoided in favor of class parameters as
22
-#   of Puppet 2.6.)
23
-#
24
-# === Examples
25
-#
26
-#  class { 'lbaas':
27
-#    servers => [ 'pool.ntp.org', 'ntp.local.company.com' ],
28
-#  }
29
-#
30
-# === Authors
31
-#
32
-# Author Name <author@domain.com>
33
-#
34
-# === Copyright
35
-#
36
-# Copyright 2014 Your name here, unless otherwise noted.
7
+#         http://www.apache.org/licenses/LICENSE-2.0
37 8
 #
9
+#    Unless required by applicable law or agreed to in writing, software
10
+#    distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
+#    WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
+#    License for the specific language governing permissions and limitations
13
+#    under the License.
14
+
38 15
 class lbaas {
39 16
   include lbaas::params
40 17
 
@@ -42,54 +19,49 @@ class lbaas {
42 19
     ensure => present,
43 20
   }
44 21
 
45
-# 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
46
-# configuration part (we will try that package with neutron is anstalled in that defined resource) and we can notify something from resource - e.g.
47
-# we can create notify from that resource to neutron-server service. But now it good in that view.
48
-# if $::osfamily == 'Debian'{
49
-#   neutron_config {
50
-#     "service_providers/service_provider": value => 'LOADBALANCER:Haproxy:neutron.services.loadbalancer.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default';
51
-#   }
52
-# }
22
+  neutron_config {
23
+    'service_providers/service_provider': value => $lbaas::params::lbaas_service_provider;
24
+  }
53 25
 
54
-# Sorry, that needs to rework, obviously, but I haven't so much time to do it.
55
-  exec { "add_lbaas_plugin":
56
-    command => "/bin/sed -i \"/`egrep -v \'(^#|^$)\' $lbaas::params::neutron_conf_file | egrep \'.*service_plugins.*\'`/ s/$/,lbaas/\" $lbaas::params::neutron_conf_file",
57
-    unless  => "/bin/egrep -v '(^#|^$)' $lbaas::params::neutron_conf_file | egrep '.*service_plugins.*lbaas.*'",
58
-    notify  => Service['neutron-server']
26
+  ini_subsetting {'enable_lbaas_plugin':
27
+    ensure               => present,
28
+    section              => 'DEFAULT',
29
+    key_val_separator    => '=',
30
+    path                 => $lbaas::params::neutron_conf_file,
31
+    setting              => 'service_plugins',
32
+    subsetting           => $lbaas::params::lbaas_service_plugin_name,
33
+    subsetting_separator => ',',
59 34
   }
60 35
 
61 36
   lbaas_config {
62
-    "DEFAULT/device_driver": value => 'neutron.services.loadbalancer.drivers.haproxy.namespace_driver.HaproxyNSDriver';
63
-    "DEFAULT/interface_driver": value => 'neutron.agent.linux.interface.OVSInterfaceDriver';
64
-    "haproxy/user_group": value => $lbaas::params::usergroup;
37
+    'DEFAULT/interface_driver': value => 'openvswitch';
65 38
   }
66 39
 
67
-# That too should be redesigned, but I'm not sure that I need to write whole new provider to change one string of code.
68
-  exec { "enable_lbaas":
69
-    command => "/bin/sed -i \"s/'enable_lb': False/'enable_lb': True/\" $lbaas::params::horizon_settings_file",
70
-    unless  => "/bin/egrep \"'enable_lb': True\" $lbaas::params::horizon_settings_file",
71
-    notify  => Service[$lbaas::params::httpd_service_name],
40
+  exec { 'neutron-db-sync':
41
+    command   => 'neutron-db-manage --subproject neutron-lbaas upgrade head',
42
+    path      => '/usr/bin',
43
+    logoutput => on_failure,
44
+    require   => Package[$lbaas::params::lbaas_package_name],
72 45
   }
73 46
 
47
+  Neutron_config<||> ~> Service<| tag == 'lbaas-service' |>
48
+  Ini_subsetting<||> ~> Service<| tag == 'lbaas-service' |>
49
+  Lbaas_config<||>   ~> Service<| tag == 'lbaas-service' |>
50
+
74 51
   service { 'neutron-server':
75
-    ensure  => running,
76
-    enable  => true,
77
-    require => Package[$lbaas::params::lbaas_package_name],
52
+    ensure     => running,
53
+    enable     => true,
54
+    tag        => 'lbaas-service',
55
+    hasstatus  => true,
56
+    hasrestart => true,
57
+    require    => Exec['neutron-db-sync'],
78 58
   }
79 59
 
80
-  service { 'neutron-lbaas-agent':
60
+  service { $lbaas::params::lbaas_service_name:
81 61
     ensure  => running,
82 62
     enable  => true,
83
-    require => Package[$lbaas::params::lbaas_package_name],
84
-  }
85
-
86
-  package { $lbaas::params::haproxy_pkg:
87
-    ensure  => present,
88
-  }
89
-
90
-  service { $lbaas::params::httpd_service_name:
91
-    enable  => true,
92
-    ensure  => running,
63
+    tag     => 'lbaas-service',
64
+    require => Exec['neutron-db-sync'],
93 65
   }
94 66
 
95 67
 }

+ 7
- 18
deployment_scripts/puppet/modules/lbaas/manifests/params.pp View File

@@ -1,21 +1,10 @@
1
+#Class lbaas::params
1 2
 class lbaas::params {
2
-  $neutron_conf_file = '/etc/neutron/neutron.conf'
3
-  $lbaas_conf_file = '/etc/neutron/lbaas_agent.ini'
4
-  $haproxy_pkg = 'haproxy'
3
+  $neutron_conf_file         = '/etc/neutron/neutron.conf'
4
+  $lbaas_conf_file           = '/etc/neutron/lbaas_agent.ini'
5
+  $lbaas_package_name        = 'neutron-lbaasv2-agent'
6
+  $lbaas_service_name        = 'neutron-lbaasv2-agent'
7
+  $lbaas_service_plugin_name = 'neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2'
8
+  $lbaas_service_provider    = 'LOADBALANCERV2:Haproxy:neutron_lbaas.drivers.haproxy.plugin_driver.HaproxyOnHostPluginDriver:default'
5 9
 
6
-  if $::osfamily == 'Debian' {
7
-    $httpd_service_name = 'apache2'
8
-    $horizon_settings_file = '/etc/openstack-dashboard/local_settings.py'
9
-    $lbaas_package_name = 'neutron-lbaas-agent'
10
-    $usergroup = 'nogroup'
11
-
12
-  } elsif($::osfamily == 'RedHat') {
13
-    $httpd_service_name = 'httpd'
14
-    $horizon_settings_file = '/etc/openstack-dashboard/local_settings'
15
-    $lbaas_package_name = 'openstack-neutron'
16
-    $usergroup = 'nobody'
17
-
18
-  } else {
19
-    fail("unsupported family ${::osfamily}")
20
-  }
21 10
 }

+ 11
- 0
deployment_tasks.yaml View File

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

+ 6
- 20
metadata.yaml View File

@@ -1,33 +1,19 @@
1 1
 name: lbaas
2 2
 title: LBaaS plugin for Neutron
3
-version: 1.0.2
3
+version: 1.0.3
4 4
 description: Enables LBaaS for Neutron. Be aware, in HA mode rescheduling of LB instances will not work!!
5
-fuel_version: ['6.1']
5
+fuel_version: ['9.0']
6 6
 licenses: ['Apache License Version 2.0']
7
-authors: ['Stanislaw Bogatkin']
7
+authors: ['Stanislaw Bogatkin, Aleksei Chekunov']
8 8
 homepage: 'https://github.com/stackforge/fuel-plugin-neutron-lbaas'
9 9
 groups: ['network']
10
+is_hotpluggable: true
10 11
 
11 12
 releases:
12 13
   - os: ubuntu
13
-    version: 2014.2-6.0
14
+    version: mitaka-9.0
14 15
     mode: ['multinode','ha']
15 16
     deployment_scripts_path: deployment_scripts/
16 17
     repository_path: repositories/ubuntu
17
-  - os: centos
18
-    version: 2014.2-6.0
19
-    mode: ['multinode','ha']
20
-    deployment_scripts_path: deployment_scripts/
21
-    repository_path: repositories/centos
22
-  - os: ubuntu
23
-    version: 2014.2-6.1
24
-    mode: ['multinode','ha']
25
-    deployment_scripts_path: deployment_scripts/
26
-    repository_path: repositories/ubuntu
27
-  - os: centos
28
-    version: 2014.2-6.1
29
-    mode: ['multinode','ha']
30
-    deployment_scripts_path: deployment_scripts/
31
-    repository_path: repositories/centos
32 18
 
33
-package_version: '2.0.0'
19
+package_version: '3.0.0'

+ 1
- 13
pre_build_hook View File

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

+ 0
- 8
tasks.yaml View File

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

Loading…
Cancel
Save