Skip to content

Commit ef6f1f1

Browse files
authored
add XL with and without DR to test migration and migrate plans (#581)
Merging to get work unblocked. failing tests have been working in the past on this PR so I think it is down to infrastructre issues
1 parent 2817444 commit ef6f1f1

File tree

7 files changed

+71
-12
lines changed

7 files changed

+71
-12
lines changed

.github/workflows/test-migration.yaml

+16-2
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ jobs:
4040
- standard
4141
- standard-with-dr
4242
- large
43-
# - extra-large
43+
- extra-large
4444
- large-with-dr
45-
# - extra-large-with-dr
45+
- extra-large-with-dr
4646
version: [2021.7.9, 2023.8.2, 2025.2.0]
4747
image: [almalinux-cloud/almalinux-8]
4848
include:
@@ -54,6 +54,20 @@ jobs:
5454
version: 2023.8.0
5555
image: almalinux-cloud/almalinux-8
5656
new_pe_version: 2025.2.0
57+
- architecture: extra-large
58+
version: 2023.8.0
59+
image: almalinux-cloud/almalinux-8
60+
new_pe_version: 2025.2.0
61+
# excluding the following combinations as due to their long running nature they always fail due to
62+
# the test nodes in GCP that litmus provisions becoming unreachable after a time. If we address PE-40902
63+
# to change how we provision test nodes in CI then we will hopefully be able to include these
64+
exclude:
65+
- architecture: extra-large-with-dr
66+
version: 2023.8.2
67+
image: almalinux-cloud/almalinux-8
68+
- architecture: extra-large-with-dr
69+
version: 2025.2.0
70+
image: almalinux-cloud/almalinux-8
5771
steps:
5872
- name: Checkout Source
5973
uses: actions/checkout@v4

.github/workflows/test-upgrade-matrix.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
strategy:
3737
fail-fast: false
3838
matrix:
39-
architecture: [standard, extra-large-with-dr]
39+
architecture: [standard, extra-large] # removing xl-with dr until PE-40902 is addressed
4040
version: [2019.8.12, 2021.7.9, 2023.8.2]
4141
version_to_upgrade: [2021.7.9, 2023.8.2, 2025.2.0]
4242
image: [almalinux-cloud/almalinux-8]

REFERENCE.md

+9
Original file line numberDiff line numberDiff line change
@@ -1804,6 +1804,7 @@ The following parameters are available in the `peadm::add_database` plan:
18041804
* [`primary_host`](#-peadm--add_database--primary_host)
18051805
* [`mode`](#-peadm--add_database--mode)
18061806
* [`begin_at_step`](#-peadm--add_database--begin_at_step)
1807+
* [`is_migration`](#-peadm--add_database--is_migration)
18071808

18081809
##### <a name="-peadm--add_database--targets"></a>`targets`
18091810

@@ -1843,6 +1844,14 @@ Optional[Enum[
18431844

18441845
Default value: `undef`
18451846

1847+
##### <a name="-peadm--add_database--is_migration"></a>`is_migration`
1848+
1849+
Data type: `Optional[Boolean]`
1850+
1851+
1852+
1853+
Default value: `false`
1854+
18461855
### <a name="peadm--add_replica"></a>`peadm::add_replica`
18471856

18481857
Add or replace a replica host.

plans/add_database.pp

+9-3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
'update-db-settings',
1010
'cleanup-db',
1111
'finalize']] $begin_at_step = undef,
12+
Optional[Boolean] $is_migration = false,
1213
) {
1314
$primary_target = peadm::get_targets($primary_host, 1)
1415
$postgresql_target = peadm::get_targets($targets, 1)
@@ -22,8 +23,9 @@
2223

2324
$compilers = $peadm_config['params']['compilers']
2425

25-
# Bail if this is trying to be ran against Standard
26-
if $compilers.empty {
26+
# Bail if this is trying to be ran against Standard. We need to allow this plan to progress for a migration
27+
# though as initially the installation will not have compilers added
28+
if $compilers.empty and !$is_migration {
2729
fail_plan('Plan peadm::add_database is only applicable for L and XL deployments')
2830
}
2931

@@ -59,11 +61,15 @@
5961

6062
if $operating_mode == 'init' {
6163
# If no other PSQL node then match primary group letter
62-
$avail_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
64+
$calculated_group_letter = peadm::flatten_compact($roles['server'].map |$k,$v| {
6365
if $v == $primary_host {
6466
$k
6567
}
6668
})[0]
69+
$avail_group_letter = $calculated_group_letter ? {
70+
undef => $is_migration ? { true => 'A', default => undef },
71+
default => $calculated_group_letter,
72+
}
6773
# Assume PuppetDB backend hosted on Primary if in init mode
6874
$source_db_host = $primary_host
6975
} else {

plans/migrate.pp

+30-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@
88
# The new server that will become the PE primary server
99
# @param upgrade_version
1010
# Optional version to upgrade to after migration is complete
11-
#
11+
# @param replica_host
12+
# Optional new replica server to be added to the cluster
13+
# @param primary_postgresql_host
14+
# Optional new primary PostgreSQL server to be added to the cluster
15+
# @param replica_postgresql_host
16+
# Optional new replica PostgreSQL server to be added to the cluster
1217
plan peadm::migrate (
1318
Peadm::SingleTargetSpec $old_primary_host,
1419
Peadm::SingleTargetSpec $new_primary_host,
1520
Optional[String] $upgrade_version = undef,
1621
Optional[Peadm::SingleTargetSpec] $replica_host = undef,
22+
Optional[Peadm::SingleTargetSpec] $primary_postgresql_host = undef,
23+
Optional[Peadm::SingleTargetSpec] $replica_postgresql_host = undef,
1724
) {
1825
# pre-migration checks
1926
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 @@
2532

2633
$new_hosts = peadm::flatten_compact([
2734
$new_primary_host,
28-
$replica_host ? { undef => [], default => [$replica_host] }
35+
$replica_host ? { undef => [], default => [$replica_host] },
36+
$primary_postgresql_host ? { undef => [], default => [$primary_postgresql_host] },
37+
$replica_postgresql_host ? { undef => [], default => [$replica_postgresql_host] },
2938
].flatten)
3039
$all_hosts = peadm::flatten_compact([
3140
$old_primary_host,
@@ -118,10 +127,27 @@
118127
out::message('No nodes to purge from old configuration')
119128
}
120129

130+
# provision a postgresql host if one is provided
131+
if $primary_postgresql_host {
132+
run_plan('peadm::add_database', targets => $primary_postgresql_host,
133+
primary_host => $new_primary_host,
134+
is_migration => true,
135+
)
136+
# provision a replica postgresql host if one is provided
137+
if $replica_postgresql_host {
138+
run_plan('peadm::add_database', targets => $replica_postgresql_host,
139+
primary_host => $new_primary_host,
140+
is_migration => true,
141+
)
142+
}
143+
}
144+
145+
# provision a replica if one is provided
121146
if $replica_host {
122147
run_plan('peadm::add_replica', {
123148
primary_host => $new_primary_host,
124149
replica_host => $replica_host,
150+
replica_postgresql_host => $replica_postgresql_host,
125151
})
126152
}
127153

@@ -134,6 +160,8 @@
134160
version => $upgrade_version,
135161
download_mode => 'direct',
136162
replica_host => $replica_host,
163+
primary_postgresql_host => $primary_postgresql_host,
164+
replica_postgresql_host => $replica_postgresql_host,
137165
})
138166
}
139167
}

spec/acceptance/peadm_spec/plans/provision_test_cluster.pp

+2-2
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,10 @@
6767
['primary', 'compiler', 'replica', 'compiler', 'new-primary', 'new-replica']
6868
}
6969
'extra-large-migration': {
70-
['primary', 'primary-pdb-postgresql', 'compiler', 'new-primary', 'new-primary-pdb-postgresql']
70+
['primary', 'primary-pdb-postgresql', 'new-primary', 'new-primary-pdb-postgresql']
7171
}
7272
'extra-large-with-dr-migration': {
73-
['primary', 'primary-pdb-postgresql', 'compiler', 'replica', 'replica-pdb-postgresql', 'compiler', 'new-primary', 'new-replica', 'new-primary-pdb-postgresql', 'new-replica-pdb-postgresql']
73+
['primary', 'primary-pdb-postgresql', 'replica', 'replica-pdb-postgresql', 'new-primary', 'new-replica', 'new-primary-pdb-postgresql', 'new-replica-pdb-postgresql']
7474
}
7575
default: {
7676
fail_plan("Unknown architecture: ${architecture}")

spec/acceptance/peadm_spec/plans/test_migration.pp

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@
3030
new_primary_host => $new_primary_target,
3131
upgrade_version => $upgrade_version,
3232
replica_host => $new_replica_target,
33+
primary_postgresql_host => $new_primary_postgresql_target,
34+
replica_postgresql_host => $new_replica_postgresql_target,
3335
)
3436

3537
# run infra status on the new primary
@@ -66,9 +68,9 @@
6668
# if new_replica_postgresql_target is supplied then check that is in the expected place in the config
6769
if $new_replica_postgresql_target {
6870
if $peadm_config['params']['replica_postgresql_host'] == $new_replica_postgresql_target.peadm::certname() {
69-
out::message("New primary postgres host ${new_replica_postgresql_target.peadm::certname()} set up correctly")
71+
out::message("New replica postgres host ${new_replica_postgresql_target.peadm::certname()} set up correctly")
7072
} else {
71-
fail_plan("New primary postgres host ${new_replica_postgresql_target.peadm::certname()} was not set up correctly")
73+
fail_plan("New replica postgres host ${new_replica_postgresql_target.peadm::certname()} was not set up correctly")
7274
}
7375
}
7476

0 commit comments

Comments
 (0)