mirror of
https://github.com/mulgadc/spinifex.git
synced 2026-10-19 02:43:17 +00:00
c6841ce1f0
* feat(oci): separate using an instance principal from creating one The allocator needs OCI credentials at runtime, and a node with none forms, passes every health check, then refuses every launch wanting a public address. Instance principal is the credential route that puts no key material on a node, but it needs a dynamic group and a policy, and those are tenancy-root resources the compartment-scoped user the rest of the configuration runs as cannot create. enable_instance_principal conflated the two, so the better credential route was only reachable by a tenancy admin. instance_principal now takes off, adopt or create: adopt selects the credential and creates nothing, because the matching rule covers the whole compartment and so names no instance to reference. setup-identity.sh owns the create case, with its own state. validate-topology.sh destroys its state at the end of every run, so holding tenancy resources there would let a teardown delete the tenancy's policy. Also package install-node.sh and smoke-test.sh, so a cluster can be formed from a curl | bash install with no checkout. smoke-test.sh is not optional: formation scp's it from its own directory for the post-formation verification. * feat(oci): take the credential handoff from an operator hook, and widen the workflow name An API-key deployment needs a credential on each node, and nothing in this repository can supply one: a key in user-data is readable from instance metadata for the life of the instance, and this host runs other people's guests. A manual install does not survive either, because a topology destroys itself on success. So the harness calls an operator-owned executable after formation and before the pool, the only window where a node has /etc/spinifex and has not started the allocator. Instance principal needs no handoff, so the hook is skipped there. The workflow is renamed for the vendors it will cover rather than the first one. Nothing is orphaned in the Actions UI: it has never been on the default branch and has never run, so there is no history attached to the old filename. * docs(oci): the API-key path needs the config file, not just the PEM oci_config_file names an ordinary OCI SDK config and nothing creates it, so a node holding only the key forms and then fails every allocation with no stated cause. * fix(ci): the runner context is not available in a job-level env block A workflow referencing it there is rejected before any job starts, which is why the rename produced a failed run attributed to the push. The reference had never been validated: a dispatch-only workflow that is never dispatched is never parsed. * fix(deps): bump containerd to v2.4.1 for GO-2026-6597 The image-pull DoS via crafted OCI index graph amplification is reachable from the ECS agent's containerd puller, so the vulnerability scan fails preflight on v2.4.0. A patch release with no API change. * fix(e2e): probe guest public addresses from outside the cloud's own network A VCN does not reflect its own public addresses back into itself, so a node asking for one gets nothing however well the datapath works. The workbook driver runs on the first node, so every assertion that curls or SSHes a guest's public address failed on OCI against a cluster that was serving those addresses correctly to the internet. The driver now takes E2E_PUBLIC_PROXY, a SOCKS5 proxy used for public addresses only, and validate-topology.sh supplies one with a remote dynamic forward on the connection that launches the driver. Egress is then the host running the validation, which is outside the VCN and is where a customer sits. Unset leaves every other platform on a direct probe, which is already correct there. Also adds --version TAG for a repeatable install, separates the workflow's auth choice from its external-pool choice so an API key can run with the allocator live, and captures allocator diagnostics before the teardown destroys them. * ci: read the Go version from go.mod in the release workflows Both pinned 1.27.0 by hand while every other workflow reads the file, so the toolchain they build with drifts from the one the module declares the day go.mod moves. release.yml was already inconsistent with itself: its second setup-go step reads spinifex/go.mod. * feat: publish the OCI topology results as tables on the run page A green tick on one job with 4,000 lines of log behind it is confidence for whoever wrote the harness and nothing to anybody else. Someone assessing whether Spinifex works on their cloud should be able to see that it formed and served guests on a single VM, on three VMs and on bare metal without opening a log. record now takes <gate> <status> [detail] and writes results.tsv beside the human block, so a gate's status is a field the script sets rather than a regex over prose that reads fine and matches wrong. record_workbooks turns the driver's own go-test-shaped lines into workbooks.tsv, and runs on the failing branch too: which four passed is most of what the fifth failing means. e2e-oci.sh --summary-only renders both tables to stdout and to GITHUB_STEP_SUMMARY, and the workflow calls it under always() before the sweep, because the sweep destroys the state directories the tables are read from. A skipped gate gets its own mark, and a topology that never ran says so: the one way a results table can do real harm is a reader taking an absent row for a passing one. * docs(oci): cut the deploy-by-hand appendix, and validate the config for real The appendix was 444 of 1014 lines restating an install the Terraform already does, which made the document read as though deploying by hand were a normal route. It is not: the configuration builds the VCN, the volumes and both VNICs per node and renders the cloud-init, in the same order every time. What is genuinely OCI-specific is four things, each of which already has a section, so the replacement names those and sends everyone else to the single-node and multi-node install guides. Verify end to end told the reader to ping a guest's public address from the host, which cannot work: a VCN does not route its own public addresses back into itself. That is the finding this branch is built on and the document was asserting the opposite. It now says where to probe from and why, and carries the allocator's `resolved the external VNIC` check, which existed only in the cut appendix and is the one line proving the credentials and compartment are right. `spx config validate` is not a command -- spx has admin, get, service, top and version -- so that line could only ever fail and its output and status were both discarded. It is replaced by parsing the TOML, which is what was wanted: the remap and the pool append are textual edits, and a broken result would otherwise surface as every service failing to start with nothing saying why. The remap now checks its own substitution count for the same reason, since re.sub with no match rewrites the file unchanged and exits 0. Publication of the run-page tables moves to one owner. GITHUB_STEP_SUMMARY is per step, so appending from the run as well as the publish step would have put two copies of every table on the run page. * fix(oci): check the credential hook before building anything The hook is a path from a CI variable, and whether it exists on the runner is knowable before Terraform runs. Checked where it was used, a wrong path cost the apply, the install and the formation first -- forty minutes and a bare-metal bill to be told a file is missing. Nothing about the check depends on the apply, so it moves to the top, where --dry-run reaches it too. * fix(oci): the summary must say what was built and what was not tested The first CI run headed its tables "Published release `latest channel`" over a build of a feature branch, which is the one error in a results table that would mislead a reader who trusted it. The header now states a tree build as a tree build, and names how the allocator authenticated. A run with no external pool says so in the header rather than leaving it to a SKIPPED row further down. Public-address allocation is the claim a green table is most likely to be read as making, and it is exactly the claim such a run cannot support. Both flags are passed to the publish step too, so the summary rendered after a failure describes the same run as the one that failed. Raise the dev prerelease prune from five to twenty. A pinned dev tag is how an external evaluator installs a specific build, and five is about a week of them -- short enough that the tag someone was handed stops resolving while they are still using it. * docs(oci): the workbook table is a snapshot, and the nightly is the current answer It is dated against a build five releases of work ago, and the nightly now runs the same workbooks on all three topologies and publishes its own table. Say which one to read rather than letting a stale table be taken as current. * ci: rename to e2e-cloudvendor.yml so the sidebar entry is registered from a valid file A workflow's displayed name is captured when GitHub first registers it and is not refreshed afterwards. Both OCI entries were registered from a run that could not be parsed -- a job-level env block referencing runner.temp -- so both list as their path, which reads as a missing name: key and is not one. The 2026-10-02 run was green on all three topologies and the entry still read as a path, with updated_at unchanged from the broken first run, so fixing the file is necessary and not sufficient. A new path is a new registration, and its first run reads a valid file. Dropping -nightly is also more honest: there is no schedule: here, because GitHub registers one only from the default branch, so a cron could never run dev and a feature branch as separate nightlies. * Revert "ci: rename to e2e-cloudvendor.yml so the sidebar entry is registered from a valid file" The rename makes the workflow undispatchable. `gh workflow run` resolves a filename against the default branch, and the raw dispatch endpoint returns 404 for a path GitHub has not registered -- checked twice, several minutes apart, so it is not an indexing delay. The old name works only because it is already registered, and an unrunnable workflow is a worse problem than a mislabelled one. The sidebar label needs a fresh registration, which a rename cannot provide from a feature branch. It corrects itself when the file reaches main, where GitHub re-reads it; the alternative is deleting the dead registrations' runs, which is an operator's call. * fix(ci): never publish the credential hook's output as an artifact The hook is the operator's own executable, and the one thing known about it is that it handles a private key. Its stdout and stderr are captured to credential-hook.log, which the artifact's *.log glob was collecting into a downloadable archive with a fourteen-day retention. Excluded rather than trusted to have been quiet. A hook that prints its key once while someone is debugging it should not thereby publish it. * fix(oci): the hairpin probe measured nothing on one node, and claimed too much With a single host, HOSTS[0] and HOSTS[-1] are the same address, so the node connected to itself -- which always succeeds. It reported "present" on vm-single and bm for that reason and not as a measurement. It now needs two nodes and says so otherwise. The claim it carried was also wrong. "A VCN does not reflect its own public addresses back into itself" was read off a workstation run whose node_client_cidr_allow_list was narrowed to one office address, which makes a node's own public address a non-permitted source: the refusal that follows is identical to an absent hairpin. With the committed 0.0.0.0/0 default the probe reports the hairpin present between two nodes, so the original reading was confounded and is retracted. None of this changes the remedy. A customer reaches a guest from outside the VCN, which is where the proxy's egress is, and probing from there is correct whichever of the two causes is in play -- 15 of 15 workbooks pass through it on all three topologies. What changes is what the documentation may assert: the guide now names both causes as indistinguishable rather than stating one as fact. * docs(oci): a reader could not run the first command, because nothing told them to clone The guide's first code block was `cd scripts/terraform/oci-spx`, into a directory no step had obtained. It also never mentioned the SSH keypair the driver refuses to start without, nor that the configuration is not on main or in v1.21.0 yet, so all three had to be inferred from the deploy failing. Restructured so the deploy comes first and reads as four steps and one command: get the configuration, choose one node or three, write the inputs, run it. The credential decision stays before step 4, because it changes an argument there and a node without one forms, looks healthy, and then refuses every launch that wants a public address. Everything else -- why OCI, sizing, the architecture, the IAM policy, quotas, the oci CLI, what Terraform builds, every variable -- moves under Reference, unchanged in substance. Adds what a successful run prints, naming `allocator ready` as the line to look for: every line above it appears on a node that cannot allocate, and that is the one failure the run does not announce. Also drops an empty verdict.txt committed from a local run. The directory the guide now tells customers to work in should not ship one run's artifacts.
199 lines
7.6 KiB
Terraform
199 lines
7.6 KiB
Terraform
variable "tenancy_ocid" { type = string }
|
|
variable "user_ocid" { type = string }
|
|
variable "fingerprint" { type = string }
|
|
variable "private_key_path" {
|
|
type = string
|
|
default = ""
|
|
}
|
|
|
|
# The PEM itself, for a CI runner that holds it as a secret in the environment.
|
|
# Exactly one of this and private_key_path is set; the check lives here so a run
|
|
# fails on the input rather than on an OCI 401 forty seconds later.
|
|
variable "private_key" {
|
|
type = string
|
|
default = ""
|
|
sensitive = true
|
|
validation {
|
|
condition = (var.private_key == "") != (var.private_key_path == "")
|
|
error_message = "Set exactly one of private_key (the PEM, for CI) or private_key_path (a file, for a workstation)."
|
|
}
|
|
}
|
|
# OCI's own region name. Spinifex's region is a separate setting that follows AWS
|
|
# naming, so ap-sydney-1 here beside ap-southeast-2 in spinifex.toml is correct.
|
|
variable "region" {
|
|
type = string
|
|
default = "ap-sydney-1"
|
|
}
|
|
# OCI serves IAM writes from the tenancy home region, which is not necessarily
|
|
# where we build: the dynamic group and policy in instance-principal.tf go through
|
|
# the oci.home provider. Unset means the two are the same region.
|
|
variable "home_region" {
|
|
description = "Tenancy home region, for IAM writes. Defaults to var.region; set OCI_HOME_REGION when they differ."
|
|
type = string
|
|
default = null
|
|
nullable = true
|
|
}
|
|
# Required, and deliberately an OCID rather than a name. This deploys into a
|
|
# compartment that already exists; creating one needs tenancy-root rights that the
|
|
# API user Spinifex runs as must not have, and a name lookup can match a deleted one.
|
|
variable "compartment_ocid" {
|
|
description = "OCID of the existing compartment to deploy into."
|
|
type = string
|
|
}
|
|
|
|
# Prefixes every resource this config owns, so nothing it creates can be confused
|
|
# with -- or collide with -- anything built by hand in the same compartment. The
|
|
# VCN dns_label takes this value directly, so keep it short and alphanumeric.
|
|
variable "deployment_name" {
|
|
description = "Name prefix for every resource this configuration creates."
|
|
type = string
|
|
default = "spinifex"
|
|
|
|
validation {
|
|
condition = can(regex("^[a-z][a-z0-9]{0,14}$", var.deployment_name))
|
|
error_message = "deployment_name must be 1-15 lowercase alphanumeric characters starting with a letter, because it is used as the VCN dns_label."
|
|
}
|
|
}
|
|
# Three values rather than a bool, because using an instance principal and being
|
|
# allowed to create one are different rights. See instance-principal.tf for what
|
|
# the policy grants and why it is narrow.
|
|
variable "instance_principal" {
|
|
description = "off: nodes use an API key. adopt: nodes authenticate as themselves against a dynamic group and policy that already exist. create: also create those two, which needs a tenancy-admin principal."
|
|
type = string
|
|
default = "off"
|
|
|
|
validation {
|
|
condition = contains(["off", "adopt", "create"], var.instance_principal)
|
|
error_message = "instance_principal must be off, adopt or create."
|
|
}
|
|
}
|
|
|
|
variable "vcn_cidr" {
|
|
description = "VCN address space. A /22 leaves room for the per-node secondary private IPs Spinifex allocates for external addresses."
|
|
type = string
|
|
default = "10.200.0.0/22"
|
|
}
|
|
variable "public_subnet_cidr" {
|
|
description = "Subnet every Spinifex node sits in, on both of its VNICs. Nodes serve the UI, predastore and the AWS gateway directly, so they cannot live in a private subnet."
|
|
type = string
|
|
default = "10.200.0.0/23"
|
|
}
|
|
variable "private_subnet_cidr" {
|
|
description = "Unused by Spinifex today; guests live on the OVN overlay, not in an OCI subnet. Kept so the subnet exists if something later needs it."
|
|
type = string
|
|
default = "10.200.2.0/24"
|
|
}
|
|
|
|
variable "compute_shape" {
|
|
description = "Compute shape for each Spinifex node. Bare metal is preferred; VM.Standard.E6.Flex is what we test on until the bare-metal quota is raised."
|
|
type = string
|
|
default = "VM.Standard.E6.Flex"
|
|
}
|
|
|
|
# A flex shape carries no size of its own, so these are not tuning knobs -- without
|
|
# them the shape is unbuildable. Both are the minimum recommended for a node.
|
|
variable "compute_ocpus" {
|
|
description = "OCPUs per node on a flex shape. OCI counts an OCPU as a full core, so 8 OCPU is 16 vCPU. Ignored on a fixed bare-metal shape."
|
|
type = number
|
|
default = 8
|
|
|
|
validation {
|
|
condition = var.compute_ocpus >= 8
|
|
error_message = "compute_ocpus must be at least 8 (16 vCPU): the minimum recommended for a Spinifex node."
|
|
}
|
|
}
|
|
|
|
variable "compute_memory_in_gbs" {
|
|
description = "Memory per node in GiB on a flex shape. Ignored on a fixed bare-metal shape."
|
|
type = number
|
|
default = 32
|
|
|
|
validation {
|
|
condition = var.compute_memory_in_gbs >= 32
|
|
error_message = "compute_memory_in_gbs must be at least 32: the minimum recommended for a Spinifex node."
|
|
}
|
|
}
|
|
|
|
variable "node_count" {
|
|
description = "Number of Spinifex nodes, each with its own data volume. 1 for the single-node replica, 3 for a cluster."
|
|
type = number
|
|
default = 1
|
|
|
|
validation {
|
|
condition = var.node_count >= 1 && var.node_count <= 25 && floor(var.node_count) == var.node_count
|
|
error_message = "node_count must be a whole number between 1 and 25."
|
|
}
|
|
}
|
|
|
|
variable "ubuntu_version" {
|
|
description = "Canonical Ubuntu platform image version."
|
|
type = string
|
|
default = "26.04"
|
|
}
|
|
|
|
variable "data_volume_size_in_gbs" {
|
|
description = "Size in GiB of the data block volume that backs /var/lib/spinifex on each node."
|
|
type = number
|
|
default = 256
|
|
}
|
|
|
|
variable "data_mountpoint" {
|
|
description = "Where cloud-init mounts the data volume. Spinifex's data directory itself, so one mount rather than a mount plus a redirect, and no config points anywhere unusual."
|
|
type = string
|
|
default = "/var/lib/spinifex"
|
|
}
|
|
|
|
variable "data_volume_vpus_per_gb" {
|
|
description = "Performance tier for each node's data volume in VPUs per GB."
|
|
type = number
|
|
default = 120
|
|
|
|
validation {
|
|
condition = var.data_volume_vpus_per_gb >= 0 && var.data_volume_vpus_per_gb <= 120
|
|
error_message = "data_volume_vpus_per_gb must be between 0 and 120."
|
|
}
|
|
}
|
|
|
|
variable "ssh_public_key_path" {
|
|
description = "Absolute path to the SSH public key installed on the Ubuntu instance."
|
|
type = string
|
|
default = null
|
|
nullable = true
|
|
}
|
|
|
|
# Nothing consumes this. It stays declared because scripts/oci_env.py exports it,
|
|
# and an undeclared TF_VAR_ is easier to misread as a broken helper than as unused.
|
|
variable "ssh_private_key_path" {
|
|
description = "Unused. The vault that imported the private key was removed; no resource needs it."
|
|
type = string
|
|
default = null
|
|
nullable = true
|
|
}
|
|
|
|
variable "node_client_cidr_allow_list" {
|
|
description = "CIDR blocks permitted to reach a node's SSH and Spinifex service ports from the internet."
|
|
type = list(string)
|
|
default = ["0.0.0.0/0"]
|
|
}
|
|
|
|
# The host firewall only. The OCI security list is deliberately open, because a
|
|
# guest's policy is its AWS security group and OVN enforces that on the node —
|
|
# see the comment on oci_core_security_list.public.
|
|
variable "node_service_ports" {
|
|
description = "TCP ports the node itself serves: console, predastore gate, AWS gateway. SSH is always opened separately."
|
|
type = list(number)
|
|
default = [3000, 8443, 9999]
|
|
}
|
|
|
|
variable "wan_bridge_name" {
|
|
description = "Linux bridge built over the secondary VNIC to carry the external datapath."
|
|
type = string
|
|
default = "br-wan"
|
|
}
|
|
|
|
variable "wan_bridge_mtu" {
|
|
description = "MTU for the WAN bridge and its member interface. The OCI VCN carries 9000."
|
|
type = number
|
|
default = 9000
|
|
}
|