Skip to content

Commit 3d19362

Browse files
committed
make features and flavors configurable
This PR introduces two new concepts: `flavor`s and `feature`s. A feature is an abstract representation of "the deployed system can now do X", usually implemented by enabling a Foreman/Pulp/Hammer plugin (or a collection of these). A flavor is a set of features that are enabled by default and can not be disabled. This is to allow our common deployment types like "vanilla foreman", "katello", "satellite" and similar. The idea is to allow people to select a baseline using `--flavor` and then further adjust it to their liking using `--feature` and the code then figures out what foreman/hammer/pulp plugin (or combination of these) needs to be enabled for that.
1 parent 1688ead commit 3d19362

File tree

20 files changed

+98
-57
lines changed

20 files changed

+98
-57
lines changed

.github/workflows/test.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -88,12 +88,12 @@ jobs:
8888
- name: Run deployment
8989
run: |
9090
./foremanctl deploy --certificate-source=${{ matrix.certificate_source }} --foreman-initial-admin-password=changeme
91-
- name: Setup hammer
91+
- name: Add optional feature - hammer
9292
run: |
93-
./foremanctl setup-hammer
94-
- name: Set up Foreman Proxy
93+
./foremanctl deploy --add-feature hammer
94+
- name: Add optional feature - foreman-proxy
9595
run: |
96-
./foremanctl setup-foreman-proxy
96+
./foremanctl deploy --add-feature foreman-proxy
9797
- name: Run tests
9898
run: |
9999
./forge test --pytest-args="--certificate-source=${{ matrix.certificate_source }}"
@@ -194,6 +194,12 @@ jobs:
194194
- name: Run deployment
195195
run: |
196196
./foremanctl deploy --foreman-initial-admin-password=changeme
197+
- name: Add optional feature - hammer
198+
run: |
199+
./foremanctl deploy --add-feature hammer
200+
- name: Add optional feature - foreman-proxy
201+
run: |
202+
./foremanctl deploy --add-feature foreman-proxy
197203
- name: Stop services
198204
run:
199205
vagrant ssh quadlet -- sudo systemctl stop foreman.target
@@ -206,12 +212,6 @@ jobs:
206212
- name: Run deployment
207213
run: |
208214
./foremanctl deploy
209-
- name: Setup hammer
210-
run: |
211-
./foremanctl setup-hammer
212-
- name: Set up Foreman Proxy
213-
run: |
214-
./foremanctl setup-foreman-proxy
215215
- name: Run tests
216216
run: |
217217
./forge test

DEVELOPMENT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ source .venv/bin/activate
3434

3535
```
3636
./forge setup-repositories
37-
./foremanctl setup-hammer
37+
./foremanctl deploy --add-feature hammer
3838
```
3939
To teardown the environment:
4040

development/playbooks/deploy-dev/deploy-dev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
become: true
55
vars_files:
66
- "../../../src/vars/defaults.yml"
7+
- "../../../src/vars/flavors/{{ flavor }}.yml"
78
- "../../../src/vars/{{ certificate_source }}_certificates.yml"
89
- "../../../src/vars/images.yml"
910
- "../../../src/vars/database.yml"

docs/deployment.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,25 @@ For example, pre-pulling images to reduce the core deployment utility runtime.
2323
6. Run deployment utility
2424
7. Post deploy checks
2525

26+
### Features and Flavors
27+
28+
To allow deployments with different sets of functionality enabled, the deployment utility supports features and flavors.
29+
30+
- A feature is an abstract representation of "the deployed system can now do X", usually implemented by enabling a Foreman/Pulp/Hammer plugin (or a collection of these).
31+
- A flavor is a set of features that are enabled by default and can not be disabled. This is to allow common deployment types like "vanilla foreman", "katello", "satellite" and similar.
32+
33+
Additionally to the functionality offered by plugins, we define the following "base" features:
34+
- `foreman` to deploy the main Rails app and make the deployment a "Server"
35+
- `foreman-proxy` to deploy the Foreman Proxy code
36+
- `hammer` to deploy the base CLI
37+
38+
These base features control which plugins are enabled when a feature is requested.
39+
- `foreman` + `remote_execution` = `foreman_remote_execution`
40+
- `foreman-proxy` + `remote_execution` = `smart_proxy_remote_execution_ssh`
41+
- `hammer` + `remote_execution` = `hammer_cli_foreman_remote_execution`
42+
43+
A deployment can have multiple base features enabled.
44+
2645
### Authenticated Registry Handling
2746

2847
In the non-default case where the image sources are supplied from an authenticated location users will need to inject a login step.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
variables:
3+
flavor:
4+
help: Base flavor to use in this deployment.
5+
features:
6+
parameter: --add-feature
7+
help: Additional features to enable in this deployment.
8+
action: append_unique
9+
remove_features:
10+
parameter: --remove-feature
11+
help: Additional features to disable in this deployment.
12+
action: remove
13+
dest: features

src/playbooks/deploy/deploy.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
become: true
66
vars_files:
77
- "../../vars/defaults.yml"
8+
- "../../vars/flavors/{{ flavor }}.yml"
89
- "../../vars/{{ certificate_source }}_certificates.yml"
910
- "../../vars/images.yml"
1011
- "../../vars/database.yml"
@@ -29,4 +30,10 @@
2930
- pulp
3031
- foreman
3132
- role: systemd_target
33+
- role: foreman_proxy
34+
when:
35+
- "'foreman-proxy' in enabled_features"
36+
- role: hammer
37+
when:
38+
- "'hammer' in enabled_features"
3239
- post_install

src/playbooks/deploy/metadata.obsah.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ include:
1717
- _database_mode
1818
- _database_connection
1919
- _tuning
20+
- _flavor_features

src/playbooks/pull-images/metadata.obsah.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ help: |
44
55
include:
66
- _database_mode
7+
- _flavor_features

src/playbooks/pull-images/pull-images.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
- quadlet
55
vars_files:
66
- "../../vars/defaults.yml"
7+
- "../../vars/flavors/{{ flavor }}.yml"
78
- "../../vars/images.yml"
9+
- "../../vars/base.yaml"
810
become: true
911
tasks:
1012
- name: Install podman
@@ -17,6 +19,13 @@
1719
name: "{{ item }}"
1820
loop: "{{ images }}"
1921

22+
- name: Pull foreman_proxy images
23+
containers.podman.podman_image:
24+
name: "{{ item }}"
25+
loop: "{{ foreman_proxy_images }}"
26+
when:
27+
- "'foreman-proxy' in enabled_features"
28+
2029
- name: Pull database images
2130
containers.podman.podman_image:
2231
name: "{{ item }}"

src/playbooks/setup-foreman-proxy/metadata.obsah.yaml

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

0 commit comments

Comments
 (0)