Skip to content

Add the ExternalVolumeSnapshot resource - #3822

Open
Sneha-at (Sneha-at) wants to merge 3 commits into
agent-substrate:mainfrom
Sneha-at:external-volume-snapshot-resource
Open

Sneha-at (Sneha-at) wants to merge 3 commits into
agent-substrate:mainfrom
Sneha-at:external-volume-snapshot-resource

Conversation

@Sneha-at

Copy link
Copy Markdown
Collaborator

Part of #1951

First step of the ExternalVolumeSnapshot design: an atespace-scoped object
for each external volume snapshot, readable through its own RPCs. Nothing
creates the objects yet. CreateTag and DeleteTag start using them in #3748,
which will be reworked onto this PR.

API

  • ExternalVolumeSnapshot with a tag origin (tag, tag_uid,
    source_volume_name, source_volume_id) and a status
    (storage_snapshot_id, ready_to_use, size_bytes, error_message).
  • GetExternalVolumeSnapshot and ListExternalVolumeSnapshots, behind the
    ExternalVolumes preview gate. An empty atespace lists every atespace and
    needs global viewer.
  • Atespace viewers can get and list. The API only reads snapshots.

Store

  • New table external_volume_snapshots, with foreign keys to atespaces and
    to tags, both ON DELETE RESTRICT, and an index on
    (atespace, tag_name, tag_uid).
  • Create locks the tag row with FOR SHARE and fails unless the tag exists
    with that uid, has a PENDING durable snapshot, and is not marked for
    deletion.
  • Updates change only status:
    • The handle and the size are set once.
    • ready_to_use only moves from false to true.
    • ready_to_use and size_bytes need a handle.
    • A later failure may replace error_message, and recording the handle
      clears it.
  • DeleteTag returns FailedPrecondition while the tag still has snapshots.

CLI

  • kubectl ate get externalvolumesnapshot, with -a or -A, plus --tag,
    which needs -a.
  • Columns: ATESPACE NAME TAG VOLUME STATE SIZE AGE. STATE is Pending,
    Failed, Captured or Ready.

Testing

  • Store contract and atepg tests, functional tests for the RPCs and
    DeleteTag, authz, validation and CLI tests.
  • New tests ran with -race -count=3 -shuffle=on.
  • hack/verify-all.sh passes.

I used an AI coding agent to implement this from the design, review it
adversarially, and draft this description. I reviewed the result myself.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

An ExternalVolumeSnapshot records one external volume snapshot. It is
owned by the tag in origin.tag, in the same atespace. The API has Get
and List only, and viewers of the atespace may use them.
Snapshots live in a new external_volume_snapshots table. Foreign keys
keep a tag or its atespace from being deleted while the tag owns
snapshots, and DeleteTag reports that as FailedPrecondition.

Create locks the tag row, and refuses a tag with a different uid, one
being deleted, or one without a PENDING durable snapshot.

No request carries a snapshot, so validation-gen generates no validator
for it. The store validates every write by hand, and lets an update
change only status: the handle and size are set once, ready_to_use only
becomes true, ready_to_use and size_bytes need a handle, and
error_message is cleared only by the write that records the handle.

GetExternalVolumeSnapshot and ListExternalVolumeSnapshots need the
ExternalVolumes preview gate and a client that opts in.
The command lists or gets snapshots in an atespace or all atespaces.
--tag keeps the snapshots of one tag, filtered in the client since the
API has no filter. It needs --atespace, because a tag name is unique
only within an atespace. The STATE column is derived from status.

This branch has not been deployed

No deployments
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