Skip to content

PE-38815 add_replica plan updated, test matrix added #480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Aug 28, 2024
124 changes: 124 additions & 0 deletions .github/workflows/test-add-replica-matrix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
---
name: "Add replica matrix"

on:
pull_request:
paths:
- ".github/workflows/**/*"
- "spec/**/*"
- "lib/**/*"
- "tasks/**/*"
- "functions/**/*"
- "types/**/*"
- "plans/**/*"
- "hiera/**/*"
- "manifests/**/*"
- "templates/**/*"
- "files/**/*"
- "metadata.json"
- "Rakefile"
- "Gemfile"
- "provision.yaml"
- ".rspec"
- ".rubocop.yml"
- ".puppet-lint.rc"
- ".fixtures.yml"
branches: [main]
workflow_dispatch: {}

jobs:
test-add-replica:
name: "PE ${{ matrix.version }} ${{ matrix.architecture }} on ${{ matrix.image }}"
runs-on: ubuntu-20.04
env:
BOLT_GEM: true
BOLT_DISABLE_ANALYTICS: true
LANG: "en_US.UTF-8"
strategy:
fail-fast: false
matrix:
architecture:
- standard
- standard-with-dr
- large
- extra-large
version:
- 2021.7.7
- 2023.6.0
image:
- almalinux-cloud/almalinux-8
steps:
- name: "Checkout Source"
uses: actions/checkout@v2

- name: "Activate Ruby 2.7"
uses: ruby/setup-ruby@v1
with:
ruby-version: "2.7"
bundler-cache: true

- name: "Print bundle environment"
if: ${{ github.repository_owner == 'puppetlabs' }}
run: |
echo ::group::info:bundler
bundle env
echo ::endgroup::

- name: 'Provision test cluster (specified architecture and a spare replica)'
timeout-minutes: 15
run: |
echo ::group::prepare
mkdir -p $HOME/.ssh
echo 'Host *' > $HOME/.ssh/config
echo ' ServerAliveInterval 150' >> $HOME/.ssh/config
echo ' ServerAliveCountMax 2' >> $HOME/.ssh/config
bundle exec rake spec_prep
echo ::endgroup::

echo ::group::provision
bundle exec bolt plan run peadm_spec::provision_test_cluster \
--modulepath spec/fixtures/modules \
provider=provision_service \
image=${{ matrix.image }} \
architecture=${{ matrix.architecture }}-and-spare-replica
echo ::endgroup::

echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::

echo ::group::info:inventory
sed -e 's/password: .*/password: "[redacted]"/' < spec/fixtures/litmus_inventory.yaml || true
echo ::endgroup::

- name: "Install PE on test cluster"
timeout-minutes: 120
run: |
bundle exec bolt plan run peadm_spec::install_test_cluster \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
architecture=${{ matrix.architecture }} \
version=${{ matrix.version }} \
code_manager_auto_configure=true

- name: 'Run add_replica plan'
timeout-minutes: 60
run: |
bundle exec bolt plan run peadm_spec::add_replica -v \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
--stream

- name: 'Tear down test cluster'
if: ${{ always() }}
continue-on-error: true
run: |
if [ -f spec/fixtures/litmus_inventory.yaml ]; then
echo ::group::tear_down
bundle exec rake 'litmus:tear_down'
echo ::endgroup::

echo ::group::info:request
cat request.json || true; echo
echo ::endgroup::
fi
12 changes: 7 additions & 5 deletions .github/workflows/test-add-replica.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
bundle env
echo ::endgroup::

- name: 'Provision test cluster (specified architecture with added DR)'
- name: 'Provision test cluster (specified architecture with spare replica)'
timeout-minutes: 15
run: |
echo ::group::prepare
Expand All @@ -79,7 +79,7 @@ jobs:
--modulepath spec/fixtures/modules \
provider=provision_service \
image=${{ matrix.image }} \
architecture=${{ matrix.architecture }}-with-dr
architecture=${{ matrix.architecture }}-and-spare-replica
echo ::endgroup::

echo ::group::info:request
Expand All @@ -97,14 +97,16 @@ jobs:
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules \
architecture=${{ matrix.architecture }} \
version=${{ matrix.version }}
version=${{ matrix.version }} \
code_manager_auto_configure=true

- name: 'Run add_replica plan'
timeout-minutes: 30
timeout-minutes: 60
run: |
bundle exec bolt plan run peadm_spec::add_replica -v \
--inventoryfile spec/fixtures/litmus_inventory.yaml \
--modulepath spec/fixtures/modules
--modulepath spec/fixtures/modules \
--stream

- name: 'Wait as long as the file ${HOME}/pause file is present'
if: ${{ always() && github.event.inputs.ssh-debugging == 'true' }}
Expand Down
8 changes: 4 additions & 4 deletions plans/add_replica.pp
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@
}

run_plan('peadm::util::update_classification', $primary_target,
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
server_b_host => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_host, default => undef },
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_host, default => undef },
server_a_host => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At the top this plan still has:

# This plan is still in development and currently considered experimental.
#
# @api private

is that still the case?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being removed in the below PR:

#478

server_b_host => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
internal_compiler_a_pool_address => $replica_avail_group_letter ? { 'A' => $replica_target.peadm::certname(), default => undef },
internal_compiler_b_pool_address => $replica_avail_group_letter ? { 'B' => $replica_target.peadm::certname(), default => undef },
peadm_config => $peadm_config
)

Expand Down
2 changes: 1 addition & 1 deletion spec/acceptance/peadm_spec/plans/add_replica.pp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
}

$primary_host = $t.filter |$n| { $n.vars['role'] == 'primary' }
$replica_host = $t.filter |$n| { $n.vars['role'] == 'replica' }
$replica_host = $t.filter |$n| { $n.vars['role'] == 'spare-replica' }
$replica_postgresql_host = $t.filter |$n| { $n.vars['role'] == 'replica-pdb-postgresql' }

if $replica_host == [] {
Expand Down
15 changes: 15 additions & 0 deletions spec/acceptance/peadm_spec/plans/provision_test_cluster.pp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,24 @@
'standard-with-dr': {
['primary', 'replica']
}
'standard-and-spare-replica': {
['primary', 'spare-replica']
}
'standard-with-dr-and-spare-replica': {
['primary', 'replica', 'spare-replica']
}
'large': {
['primary', 'compiler']
}
'large-with-dr': {
['primary', 'compiler', 'replica', 'compiler']
}
'large-and-spare-replica': {
['primary', 'compiler', 'compiler', 'spare-replica']
}
'large-with-dr-and-spare-replica': {
['primary', 'compiler', 'replica', 'compiler', 'spare-replica']
}
'extra-large': {
['primary', 'primary-pdb-postgresql', 'compiler']
}
Expand All @@ -29,6 +41,9 @@
'extra-large-with-extra-compiler': {
['primary', 'primary-pdb-postgresql', 'compiler', 'unconfigured-compiler']
}
'extra-large-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler', 'compiler', 'spare-replica']
}
'extra-large-with-dr-and-spare-replica': {
['primary', 'primary-pdb-postgresql', 'compiler',
'replica', 'replica-pdb-postgresql', 'compiler', 'spare-replica']
Expand Down
Loading