Require valid flavor id, key name and project name

Flavor id and key name are required so that amphora driver functions
properly.

Also the project name to which the amphora belongs should be a valid
name, otherwise the flavor can't be created properly.

Change-Id: I9d6050013ecd58f588cdca2ff9e32258e2e11d0d
This commit is contained in:
Takashi Kajinami 2023-07-17 20:25:03 +09:00
parent 6e17904d67
commit 533d9e0d3a
2 changed files with 20 additions and 28 deletions

View File

@ -259,7 +259,7 @@ class octavia::controller (
String[1] $heartbeat_key,
$amp_active_retries = $facts['os_service_default'],
$amp_active_wait_sec = $facts['os_service_default'],
$amp_flavor_id = '65',
String[1] $amp_flavor_id = '65',
$amp_image_tag = $facts['os_service_default'],
$amp_image_owner_id = $facts['os_service_default'],
$amp_secgroup_list = $facts['os_service_default'],
@ -275,7 +275,7 @@ class octavia::controller (
$amphora_delete_retry_interval = $facts['os_service_default'],
$event_notifications = $facts['os_service_default'],
Boolean $enable_ssh_access = true,
$amp_ssh_key_name = 'octavia-ssh-key',
String[1] $amp_ssh_key_name = 'octavia-ssh-key',
$timeout_client_data = $facts['os_service_default'],
$timeout_member_connect = $facts['os_service_default'],
$timeout_member_data = $facts['os_service_default'],

View File

@ -62,40 +62,32 @@ class octavia::worker (
Boolean $manage_keygen = false,
$ssh_key_type = 'rsa',
$ssh_key_bits = 2048,
$amp_project_name = 'services',
String[1] $amp_project_name = 'services',
) {
include octavia::deps
include octavia::params
include octavia::controller
if ! $::octavia::controller::amp_flavor_id {
if $manage_nova_flavor {
fail('When managing Nova flavor, octavia::controller::amp_flavor_id is required.')
} else {
warning('octavia::controller::amp_flavor_id is empty, Octavia Worker might not work correctly.')
if $manage_nova_flavor {
$octavia_flavor = { "octavia_${::octavia::controller::amp_flavor_id}" =>
{ 'id' => $::octavia::controller::amp_flavor_id,
'project_name' => $amp_project_name
}
}
} else {
if $manage_nova_flavor {
$octavia_flavor = { "octavia_${::octavia::controller::amp_flavor_id}" =>
{ 'id' => $::octavia::controller::amp_flavor_id,
'project_name' => $amp_project_name
}
}
$octavia_flavor_defaults = {
'ensure' => 'present',
'ram' => '1024',
'disk' => '2',
'vcpus' => '1',
'is_public' => false,
'tag' => ['octavia']
}
$nova_flavor_defaults = merge($octavia_flavor_defaults, $nova_flavor_config)
create_resources('nova_flavor', $octavia_flavor, $nova_flavor_defaults)
if $manage_service {
Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker']
}
$octavia_flavor_defaults = {
'ensure' => 'present',
'ram' => '1024',
'disk' => '2',
'vcpus' => '1',
'is_public' => false,
'tag' => ['octavia']
}
$nova_flavor_defaults = merge($octavia_flavor_defaults, $nova_flavor_config)
create_resources('nova_flavor', $octavia_flavor, $nova_flavor_defaults)
if $manage_service {
Nova_flavor<| tag == 'octavia' |> ~> Service['octavia-worker']
}
}