Extract PostgreSQL, Podman runtime and systemd lifecycle adapters while preserving existing lifecycle and scoring behavior. Update RPM layout and add guarded operator-run lab harnesses. Record successful manual stop/start, promotion, demotion and rewind-only rejoin with pinned installed hashes. The unfenced lab does not validate automatic failover, Pacemaker-managed transitions or divergent-data rewind. Validation: 103 offline tests, original-function differential checks, checksum manifest and whitespace checks passed.
75 lines
3.5 KiB
Markdown
75 lines
3.5 KiB
Markdown
# PostgreSQL HA OCF resource agent
|
|
|
|
A modular PostgreSQL HA implementation of `ocf:loxthelion:managed-container`.
|
|
Pacemaker invokes the agent to manage a rootless systemd/Quadlet maintenance
|
|
container. PostgreSQL is started and stopped independently with `pg_ctl`.
|
|
|
|
This branch extracts the frozen implementation into a PostgreSQL plugin, Podman
|
|
runtime adapter and systemd lifecycle adapter. It is **installed on ELITEDESK
|
|
in the test cluster only**. [Basic lifecycle checks](docs/lab-plugin-basic-test.md)
|
|
and [manual promotion, demotion and rewind-only rejoin tests](docs/lab-role-tests.md)
|
|
passed according to operator-supplied output. The lab has no fencing. See the
|
|
[engine contract and validation plan](docs/plugin-engine.md). The production test
|
|
report applies to the earlier freeze, not automatically to this extraction.
|
|
|
|
## Project layout
|
|
|
|
- `reference/`: original agent and immutable known-good reference copy.
|
|
- `refactored/`: executable agent, application/runtime/lifecycle modules, and a Python state helper.
|
|
- `tests/`: offline structural and behavioral comparison checks.
|
|
- `cluster-context/` and `runtime-context/`: saved lab configuration and state;
|
|
these snapshots are not live status. Environment credentials are redacted.
|
|
- `notes/`: refactor plan, validation report, and file hashes.
|
|
- `HANDOFF.md`: scope, architecture, and behavior that must be preserved.
|
|
|
|
## Validation
|
|
|
|
Requires Bash, Python 3, and the OCF shell library (normally
|
|
`/usr/lib/ocf/lib/heartbeat/ocf-shellfuncs`). From the repository root:
|
|
|
|
```bash
|
|
python3 tests/verify_refactor.py
|
|
python3 tests/test_plugin_engine.py
|
|
python3 tests/test_promotion_scores.py
|
|
python3 tests/test_promotion_scheduler.py
|
|
python3 tests/test_disconnected_state.py
|
|
python3 tests/test_promotion_cleanup.py
|
|
sha256sum -c notes/REFACTOR-SHA256SUMS
|
|
```
|
|
|
|
The tests retain all 29 original functions and verify exact equivalence after
|
|
reversing only adapter-call substitutions. They exercise the
|
|
added promotion-scoring layer without operating the live cluster. The operator
|
|
has reported successful production SBD fencing, automatic promotion, VIP movement,
|
|
and former-primary rewind/rejoin in a three-node cluster.
|
|
|
|
Read [operations](docs/operations.md), [testing and snapshot provenance](docs/testing.md),
|
|
and [the review findings](docs/review.md). Historical lab snapshots and notes are
|
|
not current production configuration. Keep `target-role=Promoted`, single-primary
|
|
limits, and the VIP's Promoted-role colocation and promotion-before-start ordering.
|
|
|
|
The public entrypoint remains `/usr/lib/ocf/resource.d/loxthelion/managed-container`.
|
|
No production changes are part of this documentation freeze.
|
|
|
|
## Clone
|
|
|
|
```bash
|
|
git clone ssh://git@gitea.loxthelion.com:2222/david/ocf-managed-container.git
|
|
```
|
|
|
|
## RPM builds
|
|
|
|
Gitea Actions builds development RPMs on `main` pushes and pull requests using
|
|
an `ubuntu-latest` runner with a Fedora 43 job container. See
|
|
[packaging instructions](packaging/README.md) for local builds and artifacts.
|
|
[License provenance remains pending](packaging/PROVENANCE.md); release publishing
|
|
and automated deployment are not configured.
|
|
|
|
## Promotion scoring
|
|
|
|
Scores are 1000 for a healthy primary, 100 for a strictly verified streaming
|
|
standby, 50 for a recently verified eligible disconnected standby, and -INFINITY
|
|
otherwise. See [the scoring design](notes/DISCONNECTED-STANDBY.md) for identity,
|
|
local state ownership, the 300-second default freshness policy and limitations.
|
|
Fencing remains mandatory; scores do not authorize unfenced manual promotion.
|