Skip to content

Commit ff397bf

Browse files
committed
feat(plans): rename add_compiler plan to add_compilers
- Renamed `peadm::add_compiler` plan to `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. BREAKING CHANGE: The plan `peadm::add_compiler` has been renamed to `peadm::add_compilers` and now supports adding multiple compilers simultaneously.
1 parent 9a9703e commit ff397bf

File tree

9 files changed

+227
-177
lines changed

9 files changed

+227
-177
lines changed

.github/workflows/test-add-compiler-matrix.yml

Lines changed: 2 additions & 2 deletions
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 }}

.github/workflows/test-add-compiler.yaml

Lines changed: 2 additions & 2 deletions
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 }} \

REFERENCE.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292

9393
#### Public Plans
9494

95-
* [`peadm::add_compiler`](#peadm--add_compiler): Add a new compiler to a PE architecture or replace an existing one with new configuration.
95+
* [`peadm::add_compilers`](#peadm--add_compilers): Add new compilers to a PE architecture or replace an existing with new configuration.
9696
* [`peadm::add_database`](#peadm--add_database)
9797
* [`peadm::add_replica`](#peadm--add_replica): Add or replace a replica host.
9898
Supported use cases:
@@ -1594,49 +1594,49 @@ Which port to query the status API on
15941594

15951595
## Plans
15961596

1597-
### <a name="peadm--add_compiler"></a>`peadm::add_compiler`
1597+
### <a name="peadm--add_compilers"></a>`peadm::add_compilers`
15981598

1599-
Add a new compiler to a PE architecture or replace an existing one with new configuration.
1599+
Add new compilers to a PE architecture or replace an existing with new configuration.
16001600

16011601
#### Parameters
16021602

1603-
The following parameters are available in the `peadm::add_compiler` plan:
1603+
The following parameters are available in the `peadm::add_compilers` plan:
16041604

1605-
* [`avail_group_letter`](#-peadm--add_compiler--avail_group_letter)
1606-
* [`compiler_host`](#-peadm--add_compiler--compiler_host)
1607-
* [`dns_alt_names`](#-peadm--add_compiler--dns_alt_names)
1608-
* [`primary_host`](#-peadm--add_compiler--primary_host)
1609-
* [`primary_postgresql_host`](#-peadm--add_compiler--primary_postgresql_host)
1605+
* [`avail_group_letter`](#-peadm--add_compilers--avail_group_letter)
1606+
* [`compiler_hosts`](#-peadm--add_compilers--compiler_hosts)
1607+
* [`dns_alt_names`](#-peadm--add_compilers--dns_alt_names)
1608+
* [`primary_host`](#-peadm--add_compilers--primary_host)
1609+
* [`primary_postgresql_host`](#-peadm--add_compilers--primary_postgresql_host)
16101610

1611-
##### <a name="-peadm--add_compiler--avail_group_letter"></a>`avail_group_letter`
1611+
##### <a name="-peadm--add_compilers--avail_group_letter"></a>`avail_group_letter`
16121612

16131613
Data type: `Enum['A', 'B']`
16141614

1615-
_ Either A or B; whichever of the two letter designations the compiler is being assigned to
1615+
_ Either A or B; whichever of the two letter designations the compilers are being assigned to
16161616

16171617
Default value: `'A'`
16181618

1619-
##### <a name="-peadm--add_compiler--compiler_host"></a>`compiler_host`
1619+
##### <a name="-peadm--add_compilers--compiler_hosts"></a>`compiler_hosts`
16201620

1621-
Data type: `Peadm::SingleTargetSpec`
1621+
Data type: `TargetSpec`
16221622

1623-
_ The hostname and certname of the new compiler
1623+
_ The hostnames and certnames of the new compilers
16241624

1625-
##### <a name="-peadm--add_compiler--dns_alt_names"></a>`dns_alt_names`
1625+
##### <a name="-peadm--add_compilers--dns_alt_names"></a>`dns_alt_names`
16261626

1627-
Data type: `Optional[String[1]]`
1627+
Data type: `Optional[Array[String[1]]]`
16281628

1629-
_ A comma_separated list of DNS alt names for the compiler
1629+
_ 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.
16301630

16311631
Default value: `undef`
16321632

1633-
##### <a name="-peadm--add_compiler--primary_host"></a>`primary_host`
1633+
##### <a name="-peadm--add_compilers--primary_host"></a>`primary_host`
16341634

16351635
Data type: `Peadm::SingleTargetSpec`
16361636

16371637
_ The hostname and certname of the primary Puppet server
16381638

1639-
##### <a name="-peadm--add_compiler--primary_postgresql_host"></a>`primary_postgresql_host`
1639+
##### <a name="-peadm--add_compilers--primary_postgresql_host"></a>`primary_postgresql_host`
16401640

16411641
Data type: `Optional[Peadm::SingleTargetSpec]`
16421642

documentation/add_compiler.md

Lines changed: 0 additions & 64 deletions
This file was deleted.

documentation/add_compilers.md

Lines changed: 93 additions & 0 deletions
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)