|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Project Overview |
| 6 | + |
| 7 | +JetBrew is an Ansible-based automation tool for deploying Red Hat OpenStack Services on OpenShift (RHOSO) on baremetal infrastructure in Scale Lab environments. It uses Validated Architecture (VA) and Deployment Templates (DT) patterns via Kustomize. |
| 8 | + |
| 9 | +## Key Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Deploy RHOSO (full end-to-end) |
| 13 | +ansible-playbook ansible/main.yml |
| 14 | + |
| 15 | +# Delete all RHOSO resources from the cluster |
| 16 | +ansible-playbook ansible/delete-rhoso.yml |
| 17 | + |
| 18 | +# Deploy external Ceph cluster |
| 19 | +ansible-playbook ansible/deploy_external_ceph.yaml |
| 20 | + |
| 21 | +# Reprovision nodes |
| 22 | +ansible-playbook utils/reprovision.yml |
| 23 | +``` |
| 24 | + |
| 25 | +All playbooks require `ansible/group_vars/all.yml` to be configured (copy from `all.sample.yml`). |
| 26 | + |
| 27 | +## Architecture |
| 28 | + |
| 29 | +### Playbook Execution Flow (`ansible/main.yml`) |
| 30 | + |
| 31 | +The main playbook runs on `localhost` with `ocp_environment` (KUBECONFIG) set, executing roles in order: |
| 32 | + |
| 33 | +1. **bootstrap** — Clones the `architecture` repo to `dt_path`, installs Kustomize, downloads OCP inventory from the lab, enables IP forwarding, optionally sets up observability operator |
| 34 | +2. **values-prep** — Discovers OCP node names/IPs/MACs, sets up SSH, finds network interfaces by MAC address, identifies common disks across nodes, renders Jinja2 templates (NNCP, service values, LVMS, kustomization.yaml) into the architecture repo |
| 35 | +3. **values-prep-dp** — Prepares EDPM (External Data Plane Management) nodeset values for compute nodes, renders dataplane templates |
| 36 | +4. **lvms** — Applies LVMS (Local Volume Manager Storage) CRs via Kustomize |
| 37 | +5. **common-osp** — Deploys core OpenStack operators |
| 38 | +6. **controlplane** — Applies NNCP, networking, and control plane CRs via Kustomize; waits for control plane readiness |
| 39 | +7. **dataplane** — Applies EDPM nodeset and deployment CRs; waits for deployment; runs nova host discovery |
| 40 | + |
| 41 | +Optional Ceph integration: If `ceph_backend: true`, a pre-play connects to the Ceph admin node and runs the `ceph-osp-prep` role (creates pools, CephX keys, exports config) before the main deployment. |
| 42 | + |
| 43 | +### Template Rendering Pattern |
| 44 | + |
| 45 | +The `values-prep` and `values-prep-dp` roles render Jinja2 templates into the cloned architecture repo at `dt_path` (default `/root/test/architecture`). The `controlplane` and `dataplane` roles then use `kustomize build` on those paths to generate and apply Kubernetes CRs. |
| 46 | + |
| 47 | +Templates are in: |
| 48 | +- `ansible/roles/values-prep/templates/` — NNCP, service values, LVMS, kustomization, Ceph service values |
| 49 | +- `ansible/roles/values-prep-dp/templates/` — EDPM nodeset values, kustomization |
| 50 | + |
| 51 | +### Key Variables (`ansible/group_vars/all.yml`) |
| 52 | + |
| 53 | +- `cloud` / `lab` — Scale Lab cloud identifier and lab type |
| 54 | +- `compute_count` — Number of compute nodes |
| 55 | +- `ssh_password` / `ssh_username` / `ssh_key_file` — Baremetal node access |
| 56 | +- `ctlplane_start_ip` — Control plane IP allocation start |
| 57 | +- `ocp_environment.KUBECONFIG` — Path to kubeconfig |
| 58 | +- `ceph_backend` — Enable Ceph storage integration (requires prior `deploy_external_ceph.yaml` run) |
| 59 | +- `dt_path` — Where the architecture repo is cloned |
| 60 | + |
| 61 | +### Deletion (`ansible/roles/cleanup-openstack`) |
| 62 | + |
| 63 | +The delete playbook uses NAD-based discovery: it finds all NetworkAttachmentDefinitions in the `openstack` namespace, then deletes only MetalLB IPAddressPools and L2Advertisements with matching names — preserving non-OpenStack MetalLB resources. |
0 commit comments