Manage ovn-octavia-provider package

... because the package is independent from the base octavia packages
and should be installed to use the provider.

Change-Id: Ide2941f388f51e35b4faab1cbc383e794fc9523d
This commit is contained in:
Takashi Kajinami 2021-10-05 08:45:30 +09:00
parent a9a19950ab
commit 588ed89e54
4 changed files with 27 additions and 3 deletions

View File

@ -8,6 +8,7 @@ class octavia::params {
$health_manager_service_name = 'octavia-health-manager' $health_manager_service_name = 'octavia-health-manager'
$housekeeping_service_name = 'octavia-housekeeping' $housekeeping_service_name = 'octavia-housekeeping'
$client_package_name = 'python3-octaviaclient' $client_package_name = 'python3-octaviaclient'
$ovn_provider_package_name = 'python3-ovn-octavia-provider'
$group = 'octavia' $group = 'octavia'
case $::osfamily { case $::osfamily {

View File

@ -2,6 +2,10 @@
# #
# == Parameters # == Parameters
# #
# [*package_ensure*]
# (optional) ensure state for package.
# Defaults to 'present'
#
# [*ovn_nb_connection*] # [*ovn_nb_connection*]
# (optional) The connection string for the OVN_Northbound OVSDB. # (optional) The connection string for the OVN_Northbound OVSDB.
# Defaults to $::os_service_default # Defaults to $::os_service_default
@ -21,13 +25,21 @@
# Defaults to $::os_service_default # Defaults to $::os_service_default
# #
class octavia::provider::ovn ( class octavia::provider::ovn (
$package_ensure = 'present',
$ovn_nb_connection = $::os_service_default, $ovn_nb_connection = $::os_service_default,
$ovn_nb_private_key = $::os_service_default, $ovn_nb_private_key = $::os_service_default,
$ovn_nb_certificate = $::os_service_default, $ovn_nb_certificate = $::os_service_default,
$ovn_nb_ca_cert = $::os_service_default $ovn_nb_ca_cert = $::os_service_default
) inherits octavia::params { ) {
include octavia::deps include octavia::deps
include octavia::params
package { 'ovn-octavia-provider':
ensure => $package_ensure,
name => $::octavia::params::ovn_provider_package_name,
tag => ['openstack', 'octavia-package'],
}
# For backward compatibility # For backward compatibility
if $::octavia::api::ovn_nb_connection and !is_service_default($::octavia::api::ovn_nb_connection) { if $::octavia::api::ovn_nb_connection and !is_service_default($::octavia::api::ovn_nb_connection) {

View File

@ -0,0 +1,5 @@
---
features:
- |
Now the ``octavia::provider::ovn`` can manage the package required to use
OVN Octavia provider.

View File

@ -3,8 +3,7 @@ require 'spec_helper'
describe 'octavia::provider::ovn' do describe 'octavia::provider::ovn' do
let :params do let :params do
{ {}
}
end end
shared_examples_for 'octavia-ovn-provider' do shared_examples_for 'octavia-ovn-provider' do
@ -14,6 +13,12 @@ describe 'octavia::provider::ovn' do
it { is_expected.to contain_octavia_config('ovn/ovn_nb_private_key').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_octavia_config('ovn/ovn_nb_private_key').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_certificate').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_octavia_config('ovn/ovn_nb_certificate').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_octavia_config('ovn/ovn_nb_ca_cert').with_value('<SERVICE DEFAULT>') } it { is_expected.to contain_octavia_config('ovn/ovn_nb_ca_cert').with_value('<SERVICE DEFAULT>') }
it { is_expected.to contain_package('ovn-octavia-provider').with(
:ensure => 'present',
:name => 'python3-ovn-octavia-provider',
:tag => ['openstack', 'octavia-package'],
) }
end end
context 'with specific parameters' do context 'with specific parameters' do
@ -40,6 +45,7 @@ describe 'octavia::provider::ovn' do
let (:facts) do let (:facts) do
facts.merge!(OSDefaults.get_facts()) facts.merge!(OSDefaults.get_facts())
end end
it_behaves_like 'octavia-ovn-provider' it_behaves_like 'octavia-ovn-provider'
end end
end end