Skip to content

Commit 315d4ea

Browse files
authored
(PE-39412) PEADM should be able to add multiple compilers at once without requiring service restarts on Primary (#512)
* feat(plans): add_compilers plan created - Added `peadm::add_compilers` to support adding multiple compilers. - Updated parameter `compiler_host` to `compiler_hosts` to accept an array of compiler targets. - Modified `dns_alt_names` parameter to accept an array of strings, each representing a comma-separated list of DNS alt names. - Updated all references in documentation and tests to reflect the new plan name. - Enhanced the plan to handle multiple compilers in parallel, including updating PostgreSQL configurations and running necessary tasks on each compiler. - Introduced a new plan `peadm::add_compiler` as a proxy for `peadm::add_compilers`.
1 parent 4b139a9 commit 315d4ea

File tree

10 files changed

+357
-232
lines changed

10 files changed

+357
-232
lines changed

Diff for: .github/workflows/test-add-compiler-matrix.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,10 @@ jobs:
8484
architecture=${{ matrix.architecture }} \
8585
console_password=${{ secrets.CONSOLE_PASSWORD }} \
8686
version=${{ matrix.version }}
87-
- name: Run add_compiler plan
87+
- name: Run add_compilers plan
8888
timeout-minutes: 50
8989
run: |
90-
bundle exec bolt plan run peadm_spec::add_compiler -v \
90+
bundle exec bolt plan run peadm_spec::add_compilers -v \
9191
--inventoryfile spec/fixtures/litmus_inventory.yaml \
9292
--modulepath spec/fixtures/modules \
9393
architecture=${{ matrix.architecture }}

Diff for: .github/workflows/test-add-compiler.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ jobs:
8585
architecture=${{ matrix.architecture }} \
8686
version=${{ matrix.version }} \
8787
console_password=${{ secrets.CONSOLE_PASSWORD }
88-
- name: Run add_compiler plan
88+
- name: Run add_compilers plan
8989
timeout-minutes: 50
9090
run: |
91-
bundle exec bolt plan run peadm_spec::add_compiler -v \
91+
bundle exec bolt plan run peadm_spec::add_compilers -v \
9292
--inventoryfile spec/fixtures/litmus_inventory.yaml \
9393
--modulepath spec/fixtures/modules \
9494
architecture=${{ matrix.architecture }} \

Diff for: REFERENCE.md

+55-4
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@
9494

9595
#### Public Plans
9696

97-
* [`peadm::add_compiler`](#peadm--add_compiler): Add a new compiler to a PE architecture or replace an existing one with new configuration.
97+
* [`peadm::add_compiler`](#peadm--add_compiler): Proxy plan for peadm::add_compilers.
98+
* [`peadm::add_compilers`](#peadm--add_compilers): Add new compilers to a PE architecture or replace an existing with new configuration.
9899
* [`peadm::add_database`](#peadm--add_database)
99100
* [`peadm::add_replica`](#peadm--add_replica): Add or replace a replica host.
100101
Supported use cases:
@@ -1610,7 +1611,7 @@ Which port to query the status API on
16101611

16111612
### <a name="peadm--add_compiler"></a>`peadm::add_compiler`
16121613

1613-
Add a new compiler to a PE architecture or replace an existing one with new configuration.
1614+
Proxy plan for peadm::add_compilers.
16141615

16151616
#### Parameters
16161617

@@ -1626,7 +1627,7 @@ The following parameters are available in the `peadm::add_compiler` plan:
16261627

16271628
Data type: `Enum['A', 'B']`
16281629

1629-
_ Either A or B; whichever of the two letter designations the compiler is being assigned to
1630+
_ Either A or B; whichever of the two letter designations the compiler are being assigned to
16301631

16311632
Default value: `'A'`
16321633

@@ -1640,7 +1641,7 @@ _ The hostname and certname of the new compiler
16401641

16411642
Data type: `Optional[String[1]]`
16421643

1643-
_ A comma_separated list of DNS alt names for the compiler
1644+
_ A comma-separated list of DNS alt names for the compiler.
16441645

16451646
Default value: `undef`
16461647

@@ -1658,6 +1659,56 @@ _ The hostname and certname of the PE-PostgreSQL server with availability group
16581659

16591660
Default value: `undef`
16601661

1662+
### <a name="peadm--add_compilers"></a>`peadm::add_compilers`
1663+
1664+
Add new compilers to a PE architecture or replace an existing with new configuration.
1665+
1666+
#### Parameters
1667+
1668+
The following parameters are available in the `peadm::add_compilers` plan:
1669+
1670+
* [`avail_group_letter`](#-peadm--add_compilers--avail_group_letter)
1671+
* [`compiler_hosts`](#-peadm--add_compilers--compiler_hosts)
1672+
* [`dns_alt_names`](#-peadm--add_compilers--dns_alt_names)
1673+
* [`primary_host`](#-peadm--add_compilers--primary_host)
1674+
* [`primary_postgresql_host`](#-peadm--add_compilers--primary_postgresql_host)
1675+
1676+
##### <a name="-peadm--add_compilers--avail_group_letter"></a>`avail_group_letter`
1677+
1678+
Data type: `Enum['A', 'B']`
1679+
1680+
_ Either A or B; whichever of the two letter designations the compilers are being assigned to
1681+
1682+
Default value: `'A'`
1683+
1684+
##### <a name="-peadm--add_compilers--compiler_hosts"></a>`compiler_hosts`
1685+
1686+
Data type: `TargetSpec`
1687+
1688+
_ The hostnames and certnames of the new compilers
1689+
1690+
##### <a name="-peadm--add_compilers--dns_alt_names"></a>`dns_alt_names`
1691+
1692+
Data type: `Optional[Array[String[1]]]`
1693+
1694+
_ An array of strings, where each string is a comma-separated list of DNS alt names for the compilers. Order matters; if a compiler doesn't need dns_alt_names, use "undef" as string.
1695+
1696+
Default value: `undef`
1697+
1698+
##### <a name="-peadm--add_compilers--primary_host"></a>`primary_host`
1699+
1700+
Data type: `Peadm::SingleTargetSpec`
1701+
1702+
_ The hostname and certname of the primary Puppet server
1703+
1704+
##### <a name="-peadm--add_compilers--primary_postgresql_host"></a>`primary_postgresql_host`
1705+
1706+
Data type: `Optional[Peadm::SingleTargetSpec]`
1707+
1708+
_ The hostname and certname of the PE-PostgreSQL server with availability group $avail_group_letter
1709+
1710+
Default value: `undef`
1711+
16611712
### <a name="peadm--add_database"></a>`peadm::add_database`
16621713

16631714
The peadm::add_database class.

Diff for: documentation/add_compiler.md

-64
This file was deleted.

Diff for: documentation/add_compilers.md

+93
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# Add Compilers
2+
3+
- [Add Compilers](#Add-Compilers)
4+
- [Introduction](#Introduction)
5+
- [Add compilers to an existing PE cluster](#Add-compilers-to-an-existing-PE-cluster)
6+
- [Running the `add_compilers` plan](#running-the-add_compilers-plan)
7+
- [Optional Parameters](#optional-parameters)
8+
9+
## Introduction
10+
11+
The `peadm::add_compilers` plan can be used to add new compilers to a PE cluster or replace an existing with new configuration.
12+
13+
## Add compilers to an existing PE cluster
14+
15+
As seen in the example below, this is the minimal parameters required to add a compiler to an existing PE cluster. These can be passed as command line variables to the plan, or in this case added to a params.json file.
16+
17+
```json
18+
{
19+
"compiler_hosts": "pe-xl-compiler-0.lab1.puppet.vm",
20+
"primary_host": "pe-xl-core-0.lab1.puppet.vm"
21+
}
22+
```
23+
24+
And for multiple compilers, this is the minimal parameters required.
25+
26+
```json
27+
{
28+
"compiler_hosts": [
29+
"pe-xl-compiler-0.lab1.puppet.vm",
30+
"pe-xl-compiler-1.lab1.puppet.vm"
31+
],
32+
"primary_host": "pe-xl-core-0.lab1.puppet.vm"
33+
}
34+
```
35+
36+
## Running the `add_compiler` plan
37+
38+
```
39+
bolt plan run peadm::add_compilers --params @params.json
40+
```
41+
42+
This command will retrieve the current PEADM configuration to determine the setup rules needed for a compiler's secondary PuppetDB instances. The plan will configure the primary with appropriate rules for allowing access from the new compiler. On the primary, the `puppet` service is stopped and the `pe-postgresql` service is reloaded. If required, a puppet agent will be installed on the new compiler host. The compiler agent's certificate is regenerated to include data required by the `peadm::subplans::component_install` plan. A subsequent Puppet agent run will happen on the following components.
43+
44+
- _\<compiler-host\>_
45+
- _\<primary_postgresql_host\>_
46+
- _\<replica host\>_
47+
- _\<primary_postgresql_host\>_
48+
49+
The `puppet` service is then restarted.
50+
51+
## Optional Parameters
52+
53+
As well as `compiler_hosts` and `primary_host`, the `add_compiler` plan has a number of optional parameters. These can be viewed in the following params example.
54+
55+
```json
56+
{
57+
"avail_group_letter": "B",
58+
"compiler_hosts": "pe-xl-compiler-0.lab1.puppet.vm",
59+
"dns_alt_names": ["puppet,puppet.lab1.puppet.vm"],
60+
"primary_host": "pe-xl-core-0.lab1.puppet.vm",
61+
"primary_postgresql_host": "pe-psql-6251cd-0.us-west1-a.c.slice-cody.internal"
62+
}
63+
```
64+
65+
for multiple compilers.
66+
67+
```json
68+
{
69+
"avail_group_letter": "B",
70+
"compiler_hosts": [
71+
"pe-xl-compiler-0.lab1.puppet.vm",
72+
"pe-xl-compiler-1.lab1.puppet.vm"
73+
],
74+
"dns_alt_names": [
75+
"puppet,puppet.lab1.puppet.vm",
76+
"puppet2,puppet.lab2.puppet.vm"
77+
],
78+
"primary_host": "pe-xl-core-0.lab1.puppet.vm",
79+
"primary_postgresql_host": "pe-psql-6251cd-0.us-west1-a.c.slice-cody.internal"
80+
}
81+
```
82+
83+
Please note, the optional parameters and values of the plan are as follows.
84+
85+
<!-- table -->
86+
87+
| Parameter | Default value | Description |
88+
| ------------------------- | ------------- | ------------------------------------------------------------------------------------------------------------------------------ |
89+
| `avail_group_letter` | `A` | By default, each compiler will be added to the primary group A. |
90+
| `dns_alt_names` | `undef` | |
91+
| `primary_postgresql_host` | `undef` | By default, this will pre-populate to the required value depending if your architecture contains HA and or external databases. |
92+
93+
For more information around adding compilers to your infrastructure [Expanding Your Deployment](expanding.md#adding-compilers-with-peadmadd_compiler)

0 commit comments

Comments
 (0)