Skip to content

test(tmachine): add a K3s HA conformance lane with PostgreSQL and mTLS - #4081

Merged
matthewgrossman merged 8 commits into
mainfrom
3529-tmachine-k3s-postgres-mtls/mg
Oct 12, 2026
Merged

matthewgrossman merged 8 commits into
mainfrom
3529-tmachine-k3s-postgres-mtls/mg

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Oct 1, 2026 •

Copy link
Copy Markdown
Member

Summary

OpenShell's newer testing path is tmachine. Each lane pairs a VM environment with an installer, and the shared conformance suite runs against it on every Branch E2E, Release Dev, and Release Tag run. Until now, tmachine couldn't set up an HA Kubernetes environment: the k3s installer deploys a single plaintext gateway. HA was covered only by the older script-based kind harness (e2e:kubernetes:ha-rebalancing), which runs in plaintext, only when a PR has the test:e2e-kubernetes label, and not in releases.

This PR adds that environment for #3529, under the testing-strategy tracker #3954. The new k3s-ha installer runs three gateway replicas on shared PostgreSQL, with chart-generated TLS and a CLI that connects over mTLS. The conformance suite now runs against a real multi-replica gateway in every tmachine run.

It also gives #3825 somewhere to put its HA tests. #3825 doesn't depend on this PR, but the lane already matches #3825's requirement that PostgreSQL HA run with TLS, so its kubernetes_ha_operations scenarios can move here later. The lane has already caught a real HA bug: concurrent sandbox stop conflicts between replicas, fixed by #4395.

Related Issue

Closes #4443, a sub-issue of #3529 (HA and failover coverage), which #3954 (testing strategy) tracks.

Depended on #4395 (merged) for a green sandbox_lifecycle scenario in the k3s-ha lane; this branch includes it.

Changes

  • Base K3s installer: openshell-k3s.yaml takes an optional Helm values overlay (openshell_k3s_helm_values_overlay, empty by default). The plain k3s lane installs exactly as before.
  • k3s-ha installer: before the base playbook runs, it applies the pinned PostgreSQL fixture. It then imports the base playbook with the HA values: 3 replicas, a Deployment, the external database, and TLS. The chart is installed once, with no plaintext install followed by an upgrade.
  • Client registration: the HA installer writes the chart's client certificate bundle and registers the gateway over HTTPS. The listener requires a client certificate; the fixture keeps allowUnauthenticatedUsers for its development user.
  • Reaching the gateway: the gateway is reached through the Service ClusterIP from test(tmachine): use K3s ClusterIP, wait for gateway, add failure diagnostics #4258. The chart's server certificate covers openshell.openshell.svc.cluster.local but not the ClusterIP, so the installer maps that name to the ClusterIP in the guest's /etc/hosts.
  • Diagnostics: K3s diagnostics now collect logs from every gateway Pod by label, instead of only openshell-0, so failures under a Deployment are covered.
  • CI matrix: k3s-ha is added to the core conformance matrix in Branch E2E, Release Dev, Release Tag, and the Integration Tests defaults. CI.md describes both K3s lanes.
nix run .#tmachine -- test ubuntu-k3s k3s-ha conformance

Testing

Checklist

  • Follows Conventional Commits
  • Commits are signed off (DCO)
  • Architecture docs updated (not applicable)

@copy-pr-bot

copy-pr-bot Bot commented Oct 1, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Drop the port-forward restart removed by the ClusterIP change, resolve the Service DNS name covered by the server certificate to the ClusterIP, bound each authenticated API wait attempt, and collect diagnostics from every gateway Pod.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman force-pushed the 3529-tmachine-k3s-postgres-mtls/mg branch from b6bd150 to e772f89 Compare October 9, 2026 20:34
Add the k3s-ha-tls installer to every core conformance matrix so Branch E2E, Release Dev, Release Tag, and manual Integration Tests cover three gateway replicas sharing PostgreSQL behind mTLS.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

TLS is part of the supported HA configuration once gateway replicas share PostgreSQL, so the installer name only needs to distinguish HA from the single-replica k3s lane.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…tgres-mtls/mg

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
Add an optional Helm values overlay to the K3s installer so the k3s-ha
installer stages PostgreSQL first and installs the three-replica TLS
gateway directly, instead of installing a plaintext gateway and upgrading.

Drop the redundant unauthenticated-users override and the install-time
API wait, which the conformance playbook already performs. Share K3s
installer inputs in the tmachine configuration.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
…tgres-mtls/mg

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
TaylorMutch
TaylorMutch previously approved these changes Oct 12, 2026
@matthewgrossman matthewgrossman changed the title test(tmachine): add K3s PostgreSQL and mTLS conformance installer test(tmachine): add a K3s HA conformance lane with PostgreSQL and mTLS Oct 12, 2026
Apply the OpenShell namespace instead of creating it so the staging play
tolerates an existing namespace, and wait for the PostgreSQL rollout so
gateway Pods do not start crash-looping against a missing database.

Reflow and pluralize the K3s lane notes in CI.md.

Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
@matthewgrossman
matthewgrossman added this pull request to the merge queue Oct 12, 2026
Merged via the queue into main with commit fc8d0d7 Oct 12, 2026
211 of 214 checks passed
@matthewgrossman
matthewgrossman deleted the 3529-tmachine-k3s-postgres-mtls/mg branch October 12, 2026 21:34
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.

test(tmachine): add a K3s HA conformance lane with PostgreSQL and mTLS

2 participants