Skip to content

feat: support Spock 6 on systemd orchestrator - #466

Open
tsivaprasad wants to merge 1 commit into
mainfrom
feature/PLAT-737/systemd-spock6-support
Open

feat: support Spock 6 on systemd orchestrator#466
tsivaprasad wants to merge 1 commit into
mainfrom
feature/PLAT-737/systemd-spock6-support

Conversation

@tsivaprasad

@tsivaprasad tsivaprasad commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR extends Spock 6 preview support, previously available only for Docker Swarm, to the systemd orchestrator by fixing package discovery and validating the changes end-to-end using a systemd fixture.

Changes

  • server/internal/orchestrator/systemd/packages.go: add "60" to supportedSpockVersions. Package name construction in apt.go/dnf.go was already parametric, so this is the only functional fix — confirmed against the real pgEdge apt/dnf repos, where the beta packages (pgedge-postgresql-<major>-spock60, pgedge-spock60_<major>, version 6.0.0~beta1) already follow the existing naming convention.
  • e2e/spock6_add_node_test.go: made orchestrator-aware. Under systemd there's no manifest or per-node image to pin, so the test lets postgres_version default and relies on spock_version: "6" alone. Now passes under both Swarm and systemd fixtures.
  • lima/ dev fixture (systemd VMs used for local dev/testing): added a DEV_LIMA_SPOCK_MAJOR toggle (Makefile, lima/Makefile, lima/roles/{deb,rhel}_prerequisites/{tasks,vars}/main.yaml), since Spock 5 and Spock 6 packages conflict with each other at the package-manager level and can't be installed side by side for the same Postgres major.
  • docs/using/image-management.md: no longer scopes the Spock 6 preview to Docker Swarm; documents the systemd package names and a caveat that, unlike Swarm's manifest, systemd has no automatic exclusion of preview versions from a database that omits spock_version.
  • changes/unreleased/Added-20260827-140429.yaml: updated to state the Spock 6 preview covers both Docker Swarm and systemd.

Testing

  • go test ./server/internal/orchestrator/systemd/... — new unit test coverage for spock50+spock60 discovery (mixed and spock60-only cases).
  • go build ./... and go vet -tags e2e_test ./e2e/...
  • Verified against a real 6-node systemd fixture (make dev-lima-deploy DEV_LIMA_SPOCK_MAJOR=60):
    • make test-e2e E2E_FIXTURE=dev-lima E2E_RUN='^TestSpock6AddNode$' — pass
    • make test-e2e E2E_FIXTURE=dev-lima E2E_RUN='^(TestFailoverScenarios|TestSwitchoverScenarios)$' — all 12 subtests pass, confirming native failover slots/switchover/failover work under Spock 6 on systemd
    • Manually created databases on Postgres 16.15, 17.11, and 18.6 with spock_version: "6", and one with no version specified (confirms Spock 6 resolves as the fixture's default) — all reported spock.version: "6.0.0" and state: available

Verification:

  1. Create env
make dev-lima-deploy DEV_LIMA_USE_STAGING_PACKAGES=false DEV_LIMA_SPOCK_MAJOR=60
➜  control-plane git:(feature/PLAT-737/systemd-spock6-support) ✗ limactl shell control-plane-dev-1 -- sudo rpm -qa | grep spock60

pgedge-spock60_18-6.0.0-beta1_1.el9.aarch64
pgedge-spock60_17-6.0.0-beta1_1.el9.aarch64
pgedge-spock60_16-6.0.0-beta1_1.el9.aarch64
  1. List hosts
➜  control-plane git:(feature/PLAT-737/systemd-spock6-support) ✗ curl -s http://localhost:3010/v1/hosts | python3 -m json.tool | grep -A2 default_pgedge_version
# expect: "postgres_version": "18.6", "spock_version": "6"

            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
--
            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
--
            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
--
            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
--
            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
--
            "default_pgedge_version": {
                "postgres_version": "18.6",
                "spock_version": "6"
  1. Verify e2e Tests
➜  control-plane git:(feature/PLAT-737/systemd-spock6-support) ✗ make test-e2e E2E_FIXTURE=dev-lima E2E_RUN='^TestSpock6AddNode$' E2E_DEBUG=1

/Users/sivat/go/bin/gotestsum  \
		--format-hide-empty-pkg \
		--format standard-verbose \
		--rerun-fails=0 \
		--rerun-fails-max-failures=4 \
		--packages='./e2e/...' \
		-- \
		-tags=e2e_test -count=1 -timeout=45m -parallel 4 -run "^TestSpock6AddNode" -args -fixture dev-lima  -debug 
2026/09/10 17:30:37 initializing cluster
2026/09/10 17:30:38 cluster initialized
=== RUN   TestSpock6AddNode
=== PAUSE TestSpock6AddNode
=== CONT  TestSpock6AddNode
    spock6_add_node_test.go:66: Step 1: Creating 2-node Spock 6 database fixture
    spock6_add_node_test.go:86: Database created: 03d0b4a8-07af-4adb-8acd-58ec9af75c77
    spock6_add_node_test.go:88: Step 2: Adding n3 node with n1 as source
    spock6_add_node_test.go:95: Add-node completed successfully against Spock 6
    spock6_add_node_test.go:97: Step 3: Waiting for full mesh replication
    database_test.go:369: [TestSpock6AddNode] waiting for replication to catch up on all nodes
    spock6_add_node_test.go:99: Replication complete
    spock6_add_node_test.go:101: Step 4: Verifying spock.spock_version() reports major 6 on the new node
    fixture_test.go:200: cleaning up database 03d0b4a8-07af-4adb-8acd-58ec9af75c77
--- PASS: TestSpock6AddNode (145.41s)
PASS
ok  	github.com/pgEdge/control-plane/e2e	146.082s

DONE 1 tests in 146.086s
  1. Create DB
curl -X POST http://localhost:3010/v1/databases -H 'Content-Type: application/json' --data '{
  "id": "spock6-default-check",
  "spec": {
    "database_name": "spock6_default_check",
    "port": 0, "patroni_port": 0,
    "database_users": [{"username": "admin", "password": "password", "db_owner": true, "attributes": ["SUPERUSER","LOGIN"]}],
    "nodes": [{"name": "n1", "host_ids": ["host-1"]}]
  }
}'

curl -X POST http://localhost:3010/v1/databases -H 'Content-Type: application/json' --data '{
  "id": "spock6-pg16-check",
  "spec": {
    "database_name": "spock6_pg16_check",
    "postgres_version": "16.15",
    "spock_version": "6",
    "port": 0, "patroni_port": 0,
    "database_users": [{"username": "admin", "password": "password", "db_owner": true, "attributes": ["SUPERUSER","LOGIN"]}],
    "nodes": [{"name": "n1", "host_ids": ["host-1"]}]
  }
}'
  1. List databases
{
  "databases": [
    {
      "id": "spock6-default-check",
      "created_at": "2026-09-10T18:08:11+05:30",
      "updated_at": "2026-09-10T18:08:11+05:30",
      "state": "available",
      "instances": [
        {
          "id": "spock6-default-check-n1-689qacsi",
          "host_id": "host-1",
          "node_name": "n1",
          "created_at": "2026-09-10T18:08:13+05:30",
          "updated_at": "2026-09-10T18:08:26+05:30",
          "status_updated_at": "2026-09-10T18:09:31+05:30",
          "state": "available",
          "connection_info": {
            "addresses": [
              "127.0.0.1"
            ],
            "port": 5925
          },
          "postgres": {
            "version": "18.6",
            "patroni_state": "running",
            "role": "primary"
          },
          "spock": {
            "read_only": "off",
            "version": "6.0.0"
          }
        }
      ]
    },
    {
      "id": "spock6-pg16-check",
      "created_at": "2026-09-10T17:41:39+05:30",
      "updated_at": "2026-09-10T17:41:39+05:30",
      "state": "available",
      "instances": [
        {
          "id": "spock6-pg16-check-n1-689qacsi",
          "host_id": "host-1",
          "node_name": "n1",
          "created_at": "2026-09-10T17:41:42+05:30",
          "updated_at": "2026-09-10T17:41:54+05:30",
          "status_updated_at": "2026-09-10T18:09:32+05:30",
          "state": "available",
          "connection_info": {
            "addresses": [
              "127.0.0.1"
            ],
            "port": 10409
          },
          "postgres": {
            "version": "16.15",
            "patroni_state": "running",
            "role": "primary"
          },
          "spock": {
            "read_only": "off",
            "version": "6.0.0"
          }
        }
      ]
    }
  ]
}

Checklist

  • Tests added or updated (unit and/or e2e, as needed)
  • Documentation updated (if needed)

PLAT-737

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 575bafab-875c-4c3b-bd34-88f43348dbe1

📥 Commits

Reviewing files that changed from the base of the PR and between d0e3189 and 6e1f786.

📒 Files selected for processing (12)
  • Makefile
  • changes/unreleased/Added-20260827-140429.yaml
  • docs/using/image-management.md
  • e2e/spock6_add_node_test.go
  • lima/Makefile
  • lima/roles/deb_prerequisites/tasks/main.yaml
  • lima/roles/deb_prerequisites/vars/main.yaml
  • lima/roles/rhel_prerequisites/tasks/main.yaml
  • lima/roles/rhel_prerequisites/vars/main.yaml
  • server/internal/orchestrator/systemd/apt_test.go
  • server/internal/orchestrator/systemd/dnf_test.go
  • server/internal/orchestrator/systemd/packages.go

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

Spock 6 preview support

Layer / File(s) Summary
Systemd package recognition and validation
server/internal/orchestrator/systemd/packages.go, server/internal/orchestrator/systemd/*_test.go
Systemd recognizes Spock 6 packages. APT and DNF tests cover Spock 5 and Spock 6 combinations.
Configurable Lima Spock major
Makefile, lima/Makefile, lima/roles/*_prerequisites/*
Lima accepts a configurable Spock major. Provisioning templates package names and removes conflicting Spock packages when the major changes.
Preview workflow and documentation
e2e/spock6_add_node_test.go, docs/using/image-management.md, changes/unreleased/*.yaml
The end-to-end test supports Swarm image pinning and systemd defaults. Documentation and the changelog describe Spock 6 preview setup for both deployment types.

Merge Risk: ⚪ Minimal · up to 6e1f7

The change enables Spock 6 preview deployments on systemd while preserving Swarm behavior, with package parsing, fixture provisioning, documentation, and end-to-end coverage supplied. No merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (8 skipped: 8… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title is concise, follows Conventional Commits style, and clearly identifies the primary change: adding Spock 6 support to the systemd orchestrator.
Description check ✅ Passed The description includes the required Summary, Changes, Testing, and Checklist sections. It documents implementation details, test results, documentation updates, and links issue PLAT-737. The Notes f…
Full details: Docstring Coverage

Explanation

Docstring coverage is 33.33% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 4 files. (8 skipped: 8 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feature/PLAT-737/systemd-spock6-support

A rabbit hops where Spock packages grow
Spock six joins the list below
Lima switches majors with care
Systemd finds previews there
Tests check each package pair
Docs guide the way with flair

Comment @coderabbitai help to get the list of available commands.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 duplication

Metric Results
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant