Skip to content

feat(fleet): profile catalog CRUD and apply-to-node with drift-ready store#49

Merged
Bugs5382 merged 3 commits into
mainfrom
feat/31-profiles
Jul 20, 2026
Merged

feat(fleet): profile catalog CRUD and apply-to-node with drift-ready store#49
Bugs5382 merged 3 commits into
mainfrom
feat/31-profiles

Conversation

@Bugs5382

Copy link
Copy Markdown
Contributor

What and why

Turns the read-only seeded profile catalog into a fleet-managed one. The catalog now persists the full cryptos.v1.CertificateProfile a node also uses, so a catalog profile applies to a node verbatim and drift is a proto compare.

  • Store persists each profile as name plus the marshaled CertificateProfile; adds Profile, CreateProfile, UpdateProfile, and DeleteProfile on both the Postgres and in-memory backends. A v2 migration drops and recreates the profiles table with (name, spec bytea) and the seed rebuilds the built-ins as full profiles (pre-GA reseed, acceptable).
  • ListProfiles now returns the full CertificateProfile. CreateProfile / UpdateProfile / DeleteProfile are admin-gated and each writes exactly one audit event (none on failure), mapping collisions to AlreadyExists and absent profiles to NotFound.
  • ApplyProfileToNode reuses the S5 whole-config-safe path: fetch the node's full config, clone it, insert-or-replace the named profile in pki.profiles[] by name, and apply the whole config back so management and every other field survive. A test asserts that safety.

Merge order: the api PR (CryptOS-PKI/api#60) must merge first; this branch consumes the api change as a branch pseudo-version until then. After api merges, go.mod re-pins to merged-main. This supersedes the housekeeping api re-pin in manager#48.

Closes #31
Part of #24

Verification

  • Lint clean (task ci: gofmt, vet, golangci-lint 0 issues)
  • Tests pass (task ci test) including Postgres integration tests run against a throwaway postgres:18-alpine with MANAGER_TEST_DATABASE_URL set and -race
  • Build succeeds (go build ./...)
  • License headers (task license)

How this was verified

task ci green with the Postgres integration tests actually executing (not skipped) against a real postgres:18-alpine on a throwaway port with -race; the v1 and v2 migrations applied and the profiles table verified as (name text PK, spec bytea). task license reports every file carries the header. The whole-config safety test proves management and other node-config fields survive ApplyProfileToNode.

Bugs5382 added 2 commits July 20, 2026 12:04
Store profiles as name plus the marshaled cryptos.v1.CertificateProfile, so
the catalog is a lossless superset a node accepts verbatim. Add Profile,
CreateProfile, UpdateProfile, and DeleteProfile to the Store interface, backed
by both the Postgres and in-memory implementations. A v2 migration drops and
recreates the profiles table with (name, spec bytea); profiles are seeded and
not operator-critical pre-GA, so the reseed is acceptable. The seed builds each
built-in as a full CertificateProfile.

Refs #31
ListProfiles now unmarshals each stored profile into the full
cryptos.v1.CertificateProfile a node also uses. Add CreateProfile,
UpdateProfile, and DeleteProfile, all admin-gated with one audit event per
successful write and none on failure, mapping a name collision to AlreadyExists
and an absent profile to NotFound.

ApplyProfileToNode reuses the S5 whole-config-safe path: it fetches the node's
full config, clones it, inserts-or-replaces the named profile in pki.profiles[]
matched by name, and applies the whole config back, so management and every
other node-config field survive.

Refs #31
@Bugs5382 Bugs5382 added this to the v1.0.0 milestone Jul 20, 2026
@Bugs5382 Bugs5382 self-assigned this Jul 20, 2026
@github-actions github-actions Bot added the enhancement New feature (feat). Minor version bump. label Jul 20, 2026
@Bugs5382
Bugs5382 merged commit 36def49 into main Jul 20, 2026
12 checks passed
@Bugs5382
Bugs5382 deleted the feat/31-profiles branch July 20, 2026 18:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature (feat). Minor version bump.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(web): profile management (catalog + node instances + overrides)

1 participant