Skip to content

feat(ua): let external agents register and issue their node key - #517

Merged
VasilyStepanov merged 5 commits into
masterfrom
feat/agent-registration-key-issuance
Jul 23, 2026
Merged

feat(ua): let external agents register and issue their node key#517
VasilyStepanov merged 5 commits into
masterfrom
feat/agent-registration-key-issuance

Conversation

@VasilyStepanov

@VasilyStepanov VasilyStepanov commented Jul 22, 2026

Copy link
Copy Markdown
Contributor
  • POST /v1/ua/agents/ now accepts creation (previously the route only allowed GET/FILTER), so an agent can register with its own uuid, node, and capabilities.
  • Adds an issue_key action on that resource (/v1/ua/agents//actions/issue_key/invoke), gated by its own agent.ua.issue_key IAM permission. It returns the node's encryption key, generating one
    only if none exists yet — so several agents registered on the same node all get back the same key, and the operation is race-safe if two of them ask at once.
  • Seeds the new agent.ua.create / agent.ua.issue_key permissions via a migration.
  • Fixes Node.insert() to reuse an existing key for its uuid instead of unconditionally creating a new one — needed because a machine can be both a plain compute Node and a local hypervisor's node,
    and both provision a key for the same uuid; previously the second registration would crash on the unique constraint.
  • Bootstrap's existing trusted key-delivery path is untouched; this adds a separate, permissioned self-service path for agents that aren't provisioned through bootstrap.

Covered by new functional tests (registration, key issuance, key sharing across agents on one node, permission enforcement) and unit tests.

Adds POST to /v1/ua/agents/ so an external agent can register itself
(uuid/node/capabilities), and a new issue_key action, gated by its own
agent.ua.issue_key permission, that returns the node's encryption key -
generating one only the first time, so agents sharing a node uuid get
the same key. Bootstrap's own key-delivery path is untouched.
@VasilyStepanov VasilyStepanov self-assigned this Jul 22, 2026
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

@VasilyStepanov

Copy link
Copy Markdown
Contributor Author

Should be merged after exordos/gcl_sdk#182

It reimplemented the same racy get-or-create pattern already fixed on
NodeEncryptionKey.get_or_create() (two agents on one node racing to
issue_key would have the loser crash on the unique node uuid instead
of getting the winner's key). Delegate to it instead of duplicating.
Node.insert() unconditionally created a NodeEncryptionKey for its
uuid, so registering a compute Node for a machine that was already a
local hypervisor's node (which provisions its own key the same way)
crashed on the unique node uuid. Route through get_or_create like
MachinePool already does.
@VasilyStepanov
VasilyStepanov marked this pull request as ready for review July 22, 2026 17:58
@VasilyStepanov
VasilyStepanov requested a review from a team as a code owner July 22, 2026 17:58
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Comment thread migrations/0069-agent-registration-key-permissions-cd5272.py Outdated
Move agent.ua.create/issue_key out of a DB migration and into
core.yaml.j2's $core.iam.permissions, matching how other elements
(e.g. exordos_world) already declare permissions in their own
manifests, and per review feedback on PR #517 that permission data
is moving away from migrations. Permission/Role/PermissionBinding
already support this via TargetResourceMixin.
@VasilyStepanov
VasilyStepanov marked this pull request as draft July 23, 2026 12:11
@VasilyStepanov
VasilyStepanov marked this pull request as ready for review July 23, 2026 13:24
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Caution

The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased.

Picks up NodeEncryptionKey.get_or_create() (gcl_sdk PR #182), now
released.
@VasilyStepanov
VasilyStepanov merged commit 1c9a13c into master Jul 23, 2026
7 checks passed
@VasilyStepanov
VasilyStepanov deleted the feat/agent-registration-key-issuance branch July 23, 2026 18:45
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.

3 participants