Refactor resource dependencies

This refactors resource dependencies to improve the following points.

 - Avoid unnecessary dependencies across services. For example aodh
   service does not require cinder db.

 - Restart keystone on change in uwsgi only when a standalone service
   is used. uwsgi config is not used when keystone is run by apache.

Change-Id: Ic4f43215ea90c6b71fe4225e2dfa6a6a3abf6869
This commit is contained in:
Takashi Kajinami
2024-03-01 02:35:11 +09:00
parent ea0074dc78
commit 9fb48f7526
6 changed files with 14 additions and 17 deletions

View File

@@ -257,4 +257,7 @@ class keystone::cache(
dead_timeout => $dead_timeout, dead_timeout => $dead_timeout,
} }
# all cache settings should be applied and all packages should be installed
# before service startup
Oslo::Cache['keystone_config'] -> Anchor['keystone::service::begin']
} }

View File

@@ -69,4 +69,7 @@ class keystone::db (
mysql_enable_ndb => $mysql_enable_ndb, mysql_enable_ndb => $mysql_enable_ndb,
} }
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db['keystone_config'] -> Anchor['keystone::dbsync::begin']
} }

View File

@@ -24,22 +24,8 @@ class keystone::deps {
~> Service<| tag == 'keystone-service' |> ~> Service<| tag == 'keystone-service' |>
~> anchor { 'keystone::service::end': } ~> anchor { 'keystone::service::end': }
# On any uwsgi config change, we must restart Keystone.
Anchor['keystone::config::begin'] Anchor['keystone::config::begin']
-> Keystone_uwsgi_config<||> -> Keystone_uwsgi_config<||>
~> Anchor['keystone::config::end']
# all cache settings should be applied and all packages should be installed
# before service startup
Oslo::Cache<||> -> Anchor['keystone::service::begin']
# all db settings should be applied and all packages should be installed
# before dbsync starts
Oslo::Db<||> -> Anchor['keystone::dbsync::begin']
# policy config should occur in the config block also.
Anchor['keystone::config::begin']
-> Openstacklib::Policy<| tag == 'keystone' |>
-> Anchor['keystone::config::end'] -> Anchor['keystone::config::end']
# Support packages need to be installed in the install phase, but we don't # Support packages need to be installed in the install phase, but we don't

View File

@@ -548,6 +548,9 @@ class keystone(
hasrestart => true, hasrestart => true,
tag => 'keystone-service', tag => 'keystone-service',
} }
# On any uwsgi config change, we must restart Keystone.
Keystone_uwsgi_config<||> ~> Service['keystone']
} }
'httpd': { 'httpd': {
include apache::params include apache::params

View File

@@ -65,11 +65,15 @@ class keystone::policy (
file_group => $::keystone::params::group, file_group => $::keystone::params::group,
file_format => 'yaml', file_format => 'yaml',
purge_config => $purge_config, purge_config => $purge_config,
tag => 'keystone',
} }
create_resources('openstacklib::policy', { $policy_path => $policy_parameters }) create_resources('openstacklib::policy', { $policy_path => $policy_parameters })
# policy config should occur in the config block also.
Anchor['keystone::config::begin']
-> Openstacklib::Policy[$policy_path]
-> Anchor['keystone::config::end']
oslo::policy { 'keystone_config': oslo::policy { 'keystone_config':
enforce_scope => $enforce_scope, enforce_scope => $enforce_scope,
enforce_new_defaults => $enforce_new_defaults, enforce_new_defaults => $enforce_new_defaults,

View File

@@ -33,7 +33,6 @@ describe 'keystone::policy' do
:file_group => 'keystone', :file_group => 'keystone',
:file_format => 'yaml', :file_format => 'yaml',
:purge_config => false, :purge_config => false,
:tag => 'keystone',
) )
is_expected.to contain_oslo__policy('keystone_config').with( is_expected.to contain_oslo__policy('keystone_config').with(
:enforce_scope => false, :enforce_scope => false,
@@ -64,7 +63,6 @@ describe 'keystone::policy' do
:file_group => 'keystone', :file_group => 'keystone',
:file_format => 'yaml', :file_format => 'yaml',
:purge_config => true, :purge_config => true,
:tag => 'keystone',
) )
is_expected.to contain_oslo__policy('keystone_config').with( is_expected.to contain_oslo__policy('keystone_config').with(
:enforce_scope => false, :enforce_scope => false,