diff --git a/.fixtures.yml b/.fixtures.yml index 59805deb..e4276a53 100644 --- a/.fixtures.yml +++ b/.fixtures.yml @@ -1,21 +1,23 @@ --- fixtures: forge_modules: - ruby_task_helper: "puppetlabs/ruby_task_helper" - service: "puppetlabs/service" - package: "puppetlabs/package" - reboot: "puppetlabs/reboot" - inifile: "puppetlabs/inifile" + ruby_task_helper: puppetlabs/ruby_task_helper + service: puppetlabs/service + package: puppetlabs/package + reboot: puppetlabs/reboot + inifile: puppetlabs/inifile repositories: - facts: "https://github.com/puppetlabs/puppetlabs-facts.git" - puppet_agent: "https://github.com/puppetlabs/puppetlabs-puppet_agent.git" - provision: "https://github.com/puppetlabs/provision.git" - stdlib: "https://github.com/puppetlabs/puppetlabs-stdlib.git" - apply_helpers: "https://github.com/puppetlabs/puppetlabs-apply_helpers" - bolt_shim: "https://github.com/puppetlabs/puppetlabs-bolt_shim" - format: "https://github.com/voxpupuli/puppet-format" - container_inventory: "https://gitlab.com/nwops/bolt-container_inventory.git" - node_manager: "https://github.com/puppetlabs/puppetlabs-node_manager.git" + facts: https://github.com/puppetlabs/puppetlabs-facts.git + puppet_agent: https://github.com/puppetlabs/puppetlabs-puppet_agent.git + provision: + repo: https://github.com/puppetlabs/provision.git + ref: v3.0.1 + stdlib: https://github.com/puppetlabs/puppetlabs-stdlib.git + apply_helpers: https://github.com/puppetlabs/puppetlabs-apply_helpers + bolt_shim: https://github.com/puppetlabs/puppetlabs-bolt_shim + format: https://github.com/voxpupuli/puppet-format + container_inventory: https://gitlab.com/nwops/bolt-container_inventory.git + node_manager: https://github.com/puppetlabs/puppetlabs-node_manager.git symlinks: - "peadm": "#{source_dir}" - "peadm_spec": "#{source_dir}/spec/acceptance/peadm_spec" + peadm: '#{source_dir}' + peadm_spec: '#{source_dir}/spec/acceptance/peadm_spec' diff --git a/.github/workflows/test-migration.yaml b/.github/workflows/test-migration.yaml index 59633b11..4ef58313 100644 --- a/.github/workflows/test-migration.yaml +++ b/.github/workflows/test-migration.yaml @@ -40,9 +40,9 @@ jobs: - standard - standard-with-dr - large - # - extra-large + - extra-large - large-with-dr - # - extra-large-with-dr + - extra-large-with-dr version: [2021.7.9, 2023.8.2, 2025.2.0] image: [almalinux-cloud/almalinux-8] include: @@ -54,6 +54,20 @@ jobs: version: 2023.8.0 image: almalinux-cloud/almalinux-8 new_pe_version: 2025.2.0 + - architecture: extra-large + version: 2023.8.0 + image: almalinux-cloud/almalinux-8 + new_pe_version: 2025.2.0 + # excluding the following combinations as due to their long running nature they always fail due to + # the test nodes in GCP that litmus provisions becoming unreachable after a time. If we address PE-40902 + # to change how we provision test nodes in CI then we will hopefully be able to include these + exclude: + - architecture: extra-large-with-dr + version: 2023.8.2 + image: almalinux-cloud/almalinux-8 + - architecture: extra-large-with-dr + version: 2025.2.0 + image: almalinux-cloud/almalinux-8 steps: - name: Checkout Source uses: actions/checkout@v4 diff --git a/.github/workflows/test-upgrade-matrix.yaml b/.github/workflows/test-upgrade-matrix.yaml index fbb718ff..b640b272 100644 --- a/.github/workflows/test-upgrade-matrix.yaml +++ b/.github/workflows/test-upgrade-matrix.yaml @@ -36,7 +36,7 @@ jobs: strategy: fail-fast: false matrix: - architecture: [standard, extra-large-with-dr] + architecture: [standard, extra-large] # removing xl-with dr until PE-40902 is addressed version: [2019.8.12, 2021.7.9, 2023.8.2] version_to_upgrade: [2021.7.9, 2023.8.2, 2025.2.0] image: [almalinux-cloud/almalinux-8] diff --git a/REFERENCE.md b/REFERENCE.md index 38d60c1f..48d95cde 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -1804,6 +1804,7 @@ The following parameters are available in the `peadm::add_database` plan: * [`primary_host`](#-peadm--add_database--primary_host) * [`mode`](#-peadm--add_database--mode) * [`begin_at_step`](#-peadm--add_database--begin_at_step) +* [`is_migration`](#-peadm--add_database--is_migration) ##### `targets` @@ -1843,6 +1844,14 @@ Optional[Enum[ Default value: `undef` +##### `is_migration` + +Data type: `Optional[Boolean]` + + + +Default value: `false` + ### `peadm::add_replica` Add or replace a replica host. diff --git a/plans/add_database.pp b/plans/add_database.pp index 72860bba..8ee62749 100644 --- a/plans/add_database.pp +++ b/plans/add_database.pp @@ -9,6 +9,7 @@ 'update-db-settings', 'cleanup-db', 'finalize']] $begin_at_step = undef, + Optional[Boolean] $is_migration = false, ) { $primary_target = peadm::get_targets($primary_host, 1) $postgresql_target = peadm::get_targets($targets, 1) @@ -22,8 +23,9 @@ $compilers = $peadm_config['params']['compilers'] - # Bail if this is trying to be ran against Standard - if $compilers.empty { + # Bail if this is trying to be ran against Standard. We need to allow this plan to progress for a migration + # though as initially the installation will not have compilers added + if $compilers.empty and !$is_migration { fail_plan('Plan peadm::add_database is only applicable for L and XL deployments') } @@ -59,11 +61,15 @@ if $operating_mode == 'init' { # If no other PSQL node then match primary group letter - $avail_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| { + $calculated_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| { if $v == $primary_host { $k } })[0] + $avail_group_letter = $calculated_group_letter ? { + undef => $is_migration ? { true => 'A', default => undef }, + default => $calculated_group_letter, + } # Assume PuppetDB backend hosted on Primary if in init mode $source_db_host = $primary_host } else { diff --git a/plans/migrate.pp b/plans/migrate.pp index 108d18d8..7aa74cfc 100644 --- a/plans/migrate.pp +++ b/plans/migrate.pp @@ -8,12 +8,19 @@ # The new server that will become the PE primary server # @param upgrade_version # Optional version to upgrade to after migration is complete -# +# @param replica_host +# Optional new replica server to be added to the cluster +# @param primary_postgresql_host +# Optional new primary PostgreSQL server to be added to the cluster +# @param replica_postgresql_host +# Optional new replica PostgreSQL server to be added to the cluster plan peadm::migrate ( Peadm::SingleTargetSpec $old_primary_host, Peadm::SingleTargetSpec $new_primary_host, Optional[String] $upgrade_version = undef, Optional[Peadm::SingleTargetSpec] $replica_host = undef, + Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef, + Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef, ) { # pre-migration checks out::message('This plan is a work in progress and it is not recommended to be used until it is fully implemented and supported') @@ -25,7 +32,9 @@ $new_hosts = peadm::flatten_compact([ $new_primary_host, - $replica_host ? { undef => [], default => [$replica_host] } + $replica_host ? { undef => [], default => [$replica_host] }, + $primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] }, + $replica_postgresql_host ? { undef => [], default => [$replica_postgresql_host] }, ].flatten) $all_hosts = peadm::flatten_compact([ $old_primary_host, @@ -118,10 +127,27 @@ out::message('No nodes to purge from old configuration') } + # provision a postgresql host if one is provided + if $primary_postgresql_host { + run_plan('peadm::add_database', targets => $primary_postgresql_host, + primary_host => $new_primary_host, + is_migration => true, + ) + # provision a replica postgresql host if one is provided + if $replica_postgresql_host { + run_plan('peadm::add_database', targets => $replica_postgresql_host, + primary_host => $new_primary_host, + is_migration => true, + ) + } + } + + # provision a replica if one is provided if $replica_host { run_plan('peadm::add_replica', { primary_host => $new_primary_host, replica_host => $replica_host, + replica_postgresql_host => $replica_postgresql_host, }) } @@ -134,6 +160,8 @@ version => $upgrade_version, download_mode => 'direct', replica_host => $replica_host, + primary_postgresql_host => $primary_postgresql_host, + replica_postgresql_host => $replica_postgresql_host, }) } } diff --git a/spec/acceptance/peadm_spec/plans/provision_test_cluster.pp b/spec/acceptance/peadm_spec/plans/provision_test_cluster.pp index e9b3451a..e86146a0 100644 --- a/spec/acceptance/peadm_spec/plans/provision_test_cluster.pp +++ b/spec/acceptance/peadm_spec/plans/provision_test_cluster.pp @@ -67,10 +67,10 @@ ['primary', 'compiler', 'replica', 'compiler', 'new-primary', 'new-replica'] } 'extra-large-migration': { - ['primary', 'primary-pdb-postgresql', 'compiler', 'new-primary', 'new-primary-pdb-postgresql'] + ['primary', 'primary-pdb-postgresql', 'new-primary', 'new-primary-pdb-postgresql'] } 'extra-large-with-dr-migration': { - ['primary', 'primary-pdb-postgresql', 'compiler', 'replica', 'replica-pdb-postgresql', 'compiler', 'new-primary', 'new-replica', 'new-primary-pdb-postgresql', 'new-replica-pdb-postgresql'] + ['primary', 'primary-pdb-postgresql', 'replica', 'replica-pdb-postgresql', 'new-primary', 'new-replica', 'new-primary-pdb-postgresql', 'new-replica-pdb-postgresql'] } default: { fail_plan("Unknown architecture: ${architecture}") diff --git a/spec/acceptance/peadm_spec/plans/test_migration.pp b/spec/acceptance/peadm_spec/plans/test_migration.pp index 7f17e636..33e9b3c9 100644 --- a/spec/acceptance/peadm_spec/plans/test_migration.pp +++ b/spec/acceptance/peadm_spec/plans/test_migration.pp @@ -30,6 +30,8 @@ new_primary_host => $new_primary_target, upgrade_version => $upgrade_version, replica_host => $new_replica_target, + primary_postgresql_host => $new_primary_postgresql_target, + replica_postgresql_host => $new_replica_postgresql_target, ) # run infra status on the new primary @@ -66,9 +68,9 @@ # if new_replica_postgresql_target is supplied then check that is in the expected place in the config if $new_replica_postgresql_target { if $peadm_config['params']['replica_postgresql_host'] == $new_replica_postgresql_target.peadm::certname() { - out::message("New primary postgres host ${new_replica_postgresql_target.peadm::certname()} set up correctly") + out::message("New replica postgres host ${new_replica_postgresql_target.peadm::certname()} set up correctly") } else { - fail_plan("New primary postgres host ${new_replica_postgresql_target.peadm::certname()} was not set up correctly") + fail_plan("New replica postgres host ${new_replica_postgresql_target.peadm::certname()} was not set up correctly") } }