Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions data/data/agent/systemd/CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Agent Installer Systemd Unit Files

When you modify systemd unit files in the `data/data/agent/systemd/units/` directory, and your changes affect the `[Unit]` section (which contains directives like `After`, `Before`, `PartOf`, etc. that define the relationships between systemd services), you must regenerate the agent installer service diagrams by running:

```bash
make -C docs/user/agent/diagrams/
```
8 changes: 4 additions & 4 deletions docs/user/agent/agent-services.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Install workflow

![Install workflow](./agent_installer_services-install_workflow.png)
![Install workflow](./agent_installer_services-install_workflow.svg)

In the install workflow, all information needed to configure a cluster is included in the agent ISO.
When the agent ISO is booted, agent-tui and nmstate libraries are copied to the host from initrd. This copy
Expand All @@ -27,7 +27,7 @@ step is required because the agent-tui and nmstate libraries are too big to fit

## Add-nodes workflow

![Add-nodes workflow](./agent_installer_services-add_nodes_workflow.png)
![Add-nodes workflow](./agent_installer_services-add_nodes_workflow.svg)

The add-nodes workflow is used to generate an ISO image for adding one or more nodes to a target cluster. It is very similar to the install workflow, with
the following exceptions (highlighted in green in the previous picture):
Expand All @@ -41,7 +41,7 @@ the following exceptions (highlighted in green in the previous picture):

## Appliance workflow (unconfigured ignition and config image)

![Appliance workflow](./agent_installer_services-unconfigured_ignition_and_config_image_flow.png)
![Appliance workflow](./agent_installer_services-unconfigured_ignition_and_config_image_flow.svg)

In the appliance workflow, most of the cluster deployment information is included in a config image that is mounted
onto the host running the unconfigured-ignition. The appliance flow does not include the agent-tui or the
Expand All @@ -55,7 +55,7 @@ so no connectivity checks to the release image is needed.

## Interactive workflow (unconfigured ignition --interactive)

![Interactive workflow](./agent_installer_services-interactive.png)
![Interactive workflow](./agent_installer_services-interactive.svg)

The interactive workflow allows the user to install a cluster by using the assisted UI running on the rendezvous node. In this workflow
the agent-tui is also used interactively to configure which node will be the rendezvous host, and to configure accordingly the other nodes.
Expand Down
Binary file not shown.
349 changes: 349 additions & 0 deletions docs/user/agent/agent_installer_services-add_nodes_workflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
337 changes: 337 additions & 0 deletions docs/user/agent/agent_installer_services-install_workflow.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
304 changes: 304 additions & 0 deletions docs/user/agent/agent_installer_services-interactive.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/user/agent/diagrams/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated .dot files (intermediate products)
*.dot
__pycache__/
37 changes: 37 additions & 0 deletions docs/user/agent/diagrams/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
.PHONY: all clean help

SVG_FILES := ../agent_installer_services-install_workflow.svg \
../agent_installer_services-add_nodes_workflow.svg \
../agent_installer_services-unconfigured_ignition_and_config_image_flow.svg \
../agent_installer_services-interactive.svg
DOT_FILES := $(patsubst ../agent_installer_services-%.svg,%.dot,$(SVG_FILES))

# Find all systemd unit files that the generator depends on
SYSTEMD_UNITS := $(wildcard ../../../../data/data/agent/systemd/units/*.service) \
$(wildcard ../../../../data/data/agent/systemd/units/*.service.template)

all: $(SVG_FILES)

# Generate DOT files from systemd units
$(DOT_FILES): generate_diagrams.py $(SYSTEMD_UNITS)
python3 generate_diagrams.py

# Pattern rule: build SVG from DOT file
../agent_installer_services-%.svg: %.dot
dot -Tsvg $< -o $@

clean:
rm -f $(SVG_FILES) $(DOT_FILES)

# Help target
help:
@echo "Available targets:"
@echo " all - Generate all SVG diagrams (auto-generates DOT files from systemd units) (default)"
@echo " clean - Remove generated SVG and DOT files"
@echo " help - Show this help message"
@echo ""
@echo "The diagrams are auto-generated from systemd units in:"
@echo " ../../../../data/data/agent/systemd/units/"
@echo ""
@echo "Generated files:"
@echo " $(SVG_FILES)" | tr ' ' '\n' | sed 's/^/ /'"
86 changes: 86 additions & 0 deletions docs/user/agent/diagrams/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# Agent Installer Service Diagrams

This directory contains the auto-generation system for agent installer service workflow diagrams.

## Structure

- `generate_diagrams.py` - Python script to auto-generate DOT files from systemd units
- `Makefile` - Build script with dependency tracking
- `*.dot` - GraphViz DOT source files (generated, not tracked in git)
- `.gitignore` - Excludes generated .dot files
- `README.md` - This file

## Diagrams

The system generates four workflow diagrams:

1. **install_workflow** - Standard agent-based installation workflow
2. **add_nodes_workflow** - Add-nodes workflow (differences highlighted in green)
3. **unconfigured_ignition** - Appliance/factory workflow with config image
4. **interactive** - Interactive installation workflow using assisted UI

## Building

To regenerate the diagrams:

```bash
cd docs/user/agent/diagrams
make
```

This single command will:
1. Auto-generate `.dot` files from systemd units (if units changed)
2. Generate SVG files from the `.dot` files (if `.dot` files changed)

The diagrams are automatically regenerated when:
- Any systemd unit file in `data/data/agent/systemd/units/` changes
- The `generate_diagrams.py` script changes

Output files are created in the parent directory:
- `agent_installer_services-install_workflow.svg`
- `agent_installer_services-add_nodes_workflow.svg`
- `agent_installer_services-unconfigured_ignition_and_config_image_flow.svg`
- `agent_installer_services-interactive.svg`

## How It Works

The generator parses systemd unit files and extracts:
- **Service dependencies**: `Before=` and `After=` directives become edges
- **Cluster membership**: `PartOf=` and `BindsTo=` define dashed boxes
- **Workflow filters**: `ConditionPathExists` determines which services run in each workflow
- **File dependencies**: `ConditionPathExists` on files creates dotted edges

The system is mostly data-driven with a few hardcoded exceptions:
- `load-config-iso@` is triggered by udev (unconfigured_ignition only)
- `start-cluster-installation` excluded from interactive (transitive dependency)
- `99-agent-copy-files.sh` excluded from interactive (agent-extract-tui provides tui)

## Diagram Features

- **Layout**: Bottom-to-top (dependencies flow upward)
- **Color coding**:
- Light blue - standard services
- Dark blue (thick border) - orchestrator services
- Thin border - disconnected services
- Green border/text - differences in add-nodes workflow
- Yellow - configuration files
- **Dotted edges**: File creation or conditional dependencies
- **Dashed boxes**: Service clusters (PartOf/BindsTo relationships)

## Requirements

- GraphViz (`dot` command) must be installed
- Fedora/RHEL: `dnf install graphviz`
- Ubuntu/Debian: `apt install graphviz`
- macOS: `brew install graphviz`
- Python 3 (for auto-generation)

## Cleaning

To remove all generated files:

```bash
make clean
```

This removes both `.dot` and `.svg` files.
Loading