From 588ed89e54b3a8823586e99629ec28aefc923ae2 Mon Sep 17 00:00:00 2001 From: Takashi Kajinami Date: Tue, 5 Oct 2021 08:45:30 +0900 Subject: [PATCH] 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 --- manifests/params.pp | 1 + manifests/provider/ovn.pp | 14 +++++++++++++- .../ovn-provider-package-af40f696662e7052.yaml | 5 +++++ spec/classes/octavia_provider_ovn_spec.rb | 10 ++++++++-- 4 files changed, 27 insertions(+), 3 deletions(-) create mode 100644 releasenotes/notes/ovn-provider-package-af40f696662e7052.yaml diff --git a/manifests/params.pp b/manifests/params.pp index 60bb6ecf..62b6607e 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -8,6 +8,7 @@ class octavia::params { $health_manager_service_name = 'octavia-health-manager' $housekeeping_service_name = 'octavia-housekeeping' $client_package_name = 'python3-octaviaclient' + $ovn_provider_package_name = 'python3-ovn-octavia-provider' $group = 'octavia' case $::osfamily { diff --git a/manifests/provider/ovn.pp b/manifests/provider/ovn.pp index 4e24b4dd..59404fb3 100644 --- a/manifests/provider/ovn.pp +++ b/manifests/provider/ovn.pp @@ -2,6 +2,10 @@ # # == Parameters # +# [*package_ensure*] +# (optional) ensure state for package. +# Defaults to 'present' +# # [*ovn_nb_connection*] # (optional) The connection string for the OVN_Northbound OVSDB. # Defaults to $::os_service_default @@ -21,13 +25,21 @@ # Defaults to $::os_service_default # class octavia::provider::ovn ( + $package_ensure = 'present', $ovn_nb_connection = $::os_service_default, $ovn_nb_private_key = $::os_service_default, $ovn_nb_certificate = $::os_service_default, $ovn_nb_ca_cert = $::os_service_default -) inherits octavia::params { +) { 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 if $::octavia::api::ovn_nb_connection and !is_service_default($::octavia::api::ovn_nb_connection) { diff --git a/releasenotes/notes/ovn-provider-package-af40f696662e7052.yaml b/releasenotes/notes/ovn-provider-package-af40f696662e7052.yaml new file mode 100644 index 00000000..119cbc29 --- /dev/null +++ b/releasenotes/notes/ovn-provider-package-af40f696662e7052.yaml @@ -0,0 +1,5 @@ +--- +features: + - | + Now the ``octavia::provider::ovn`` can manage the package required to use + OVN Octavia provider. diff --git a/spec/classes/octavia_provider_ovn_spec.rb b/spec/classes/octavia_provider_ovn_spec.rb index e7611c29..904be598 100644 --- a/spec/classes/octavia_provider_ovn_spec.rb +++ b/spec/classes/octavia_provider_ovn_spec.rb @@ -3,8 +3,7 @@ require 'spec_helper' describe 'octavia::provider::ovn' do let :params do - { - } + {} end 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('') } it { is_expected.to contain_octavia_config('ovn/ovn_nb_certificate').with_value('') } it { is_expected.to contain_octavia_config('ovn/ovn_nb_ca_cert').with_value('') } + + it { is_expected.to contain_package('ovn-octavia-provider').with( + :ensure => 'present', + :name => 'python3-ovn-octavia-provider', + :tag => ['openstack', 'octavia-package'], + ) } end context 'with specific parameters' do @@ -40,6 +45,7 @@ describe 'octavia::provider::ovn' do let (:facts) do facts.merge!(OSDefaults.get_facts()) end + it_behaves_like 'octavia-ovn-provider' end end