Skip to content

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Azure Blob object-store plugin

This plugin implements Agent Substrate's substrate.objectstore.v1 node and control services with Azure Blob Storage, and its AssetProvider for sandbox assets. It runs in node mode beside atelet and in control mode beside ate-api-server. The module imports only substrate's public api/ and pkg/ packages.

The plugin stores each requested snapshot file as one block blob. Uploads use deterministic staged block IDs and atomically replace the committed block list, so a retry after a partial upload is safe. Each blob carries a SHA-256 digest in metadata. Fetch and copy verify that digest before exposing or committing the destination bytes. Azure also verifies each staged block's MD5 in transit.

Compatibility

The plugin needs a substrate that serves the substrate.objectstore.v1 proto package, introduced by agent-substrate/substrate@48f5744. As of 2026-10-28, no substrate release includes it and the release-0.6 branch does not either. Releases cut from main after that commit will; v0.6.x patch releases cut from release-0.6 will not unless the commit is cherry-picked there. v0.6.0 and earlier call the old objectstore.v1 service name, so this plugin answers them with Unimplemented. go.mod pins the substrate version the plugin is built and tested against.

Sidecars

Substrate's install manifests run an objectstore-plugin native sidecar next to atelet and ate-api-server, and the callers reach it over a Unix socket in a pod-local emptyDir:

  • node socket: /run/objectstore-plugin/node.sock
  • control socket: /run/objectstore-plugin/control.sock
  • node snapshot root: /var/lib/ate

The config/ component replaces those sidecars' image and arguments with this plugin's, removes the base ATE_STORAGE_BACKEND, adds the workload identity environment and projected token, and points their startup probes at azure-blob-objectstore-plugin healthcheck, which reports whether the plugin at --socket is serving gRPC health. It leaves the caller containers and the socket volume as the base defines them. The base control sidecar's credential exchange settings also stay: the exchange port, ATE_API_ACTOR_JWT_ISSUER, POD_NAMESPACE, and the servicedns, podidentity and actor-id-jwt-jwks mounts; this plugin serves no exchange and reads none of them. The ATE_API_SNAPSHOT_TRANSFER_SERVICE_ACCOUNT variable still comes from the ConfigMap key ate-setup writes, so a hand-written ConfigMap must still carry that key for the pod to start. On the kind overlay, the AWS_* variables its RustFS patches add also stay on both sidecars; the plugin reads none of them.

Snapshot URIs

The plugin accepts:

azblob://<container>/<snapshot-prefix>

<container> must be one of --containers, and CopySnapshot may copy between any two of them. --prefix, when set, is prepended to every snapshot prefix in every container, allowing all substrate data to live below one directory. The blob name prefix is the URI's percent-decoded path, so root%2Fsub and root/sub name the same blobs, as they do in substrate's objectstore-plugin. A bare container, userinfo, a query or fragment, \, and ., .. or other path segments made only of dots and spaces are rejected.

Sandbox assets

In node mode with --asset-containers set (the config/assets component sets it), the plugin also serves AssetProvider.FetchAsset, which atelet calls for every sandbox asset URL that is not gs:// (for example the micro-VM kernel, rootfs, cloud-hypervisor and virtiofsd in a SandboxConfig). Asset URLs use the blob's native URL in the plugin's account:

https://<account>.blob.core.windows.net/<container>/<blob>

<container> must be one of --asset-containers; it may also be a snapshot container. The blob name is used as is: --prefix does not apply. A URL on another host, with a query (such as a SAS token), user info or a fragment, or with a non-canonical blob name (empty, .-terminated or space-padded segments, \) is rejected with InvalidArgument.

The plugin applies the same two checks as substrate's objectstore-plugin, through substrate's pkg/assetfetch:

  • It refuses, with PermissionDenied and before any download, any blob stored under a snapshot or tag location (.../atespaces/<atespace>/actors/<uid>/snapshots/<name>/... or .../atespaces/<atespace>/tags/<uid>/...) in any container, so the node identity's read access to snapshots cannot be used to read them as assets.
  • It downloads into --asset-staging-dir, which only the plugin container mounts, stops at max_bytes, verifies the requested sha256, and only then atomically replaces atelet's existing file with the bytes. atelet verifies the sha256 again.

Downloads in flight hold at most --asset-staging-capacity bytes in the staging directory together: each reserves its blob's size, and one that does not fit waits for the others. A blob larger than the capacity is refused with FailedPrecondition. The default, 8Gi, matches atelet's per-asset cap and the base manifest's asset-staging volume.

The node identity needs Storage Blob Data Reader on each asset container that is not also a snapshot container.

Without --asset-containers, atelet's plugin serves no assets and atelet gets Unimplemented: it still reads public gs:// assets, such as the default gVisor release, anonymously, and fails any other asset URL. The config/ component alone is therefore a snapshot-only install; see Deployment for adding assets.

Configuration

Flag Environment fallback Default Purpose
--account-url AZURE_STORAGE_ACCOUNT_URL required https://<account>.blob.core.windows.net
--containers AZURE_STORAGE_CONTAINERS required Comma-separated blob containers that snapshot URIs may name; a name that breaks Azure's container naming rules fails startup
--prefix AZURE_STORAGE_PREFIX empty Prefix prepended to every snapshot key
--socket none required Unix socket to serve
--root none /var/lib/ate Node mode's allowed local snapshot and asset tree
--asset-containers AZURE_STORAGE_ASSET_CONTAINERS empty Node mode: comma-separated blob containers that sandbox asset URLs may name; empty serves no assets (atelet then gets Unimplemented)
--asset-staging-dir none /var/lib/objectstore-plugin/asset-staging Node mode: private directory assets are downloaded into and verified in; must not be below --root
--asset-staging-capacity none 8Gi Node mode: the most asset downloads in --asset-staging-dir may hold at once, as a Kubernetes quantity

healthcheck mode takes --socket and --timeout (default 5s) and exits non-zero unless the plugin at --socket reports SERVING within the timeout.

The account URL must use https. The plugin sends requests, and with them its storage token, only to the scheme and host of --account-url: it refuses a request to any other endpoint and does not follow redirects. Snapshot URIs name only a container and prefix, never a host, so no request can choose where the token goes.

Authentication

The plugin authenticates to Azure Storage only with Microsoft Entra workload identity federation: it exchanges the pod's projected service account token for an Entra token. It does not accept storage account keys, connection strings, SAS tokens, client secrets or certificates, and never authenticates as the node's managed identity. It reads the standard azidentity variables:

Variable Value
AZURE_CLIENT_ID Client ID of the user-assigned managed identity whose federated identity credential trusts the cluster's service account token issuer
AZURE_TENANT_ID Microsoft Entra tenant ID
AZURE_FEDERATED_TOKEN_FILE Path of the projected service account token

The plugin fails at startup, naming the missing variables, when any of them is unset or the token file cannot be read. It has no other credential to fall back to.

Create federated identity credentials with audience api://AzureADTokenExchange, the cluster's service account issuer, and these subjects:

system:serviceaccount:ate-system:atelet
system:serviceaccount:ate-system:ate-api-server

Microsoft Entra ID must be able to fetch the issuer's OIDC discovery document and signing keys.

Grant each identity Storage Blob Data Contributor scoped to each container in --containers:

CONTAINER_SCOPE="/subscriptions/<subscription>/resourceGroups/<resource-group>/providers/Microsoft.Storage/storageAccounts/<account>/blobServices/default/containers/<container>"
az role assignment create \
  --assignee-object-id <principal-object-id> \
  --assignee-principal-type ServicePrincipal \
  --role "Storage Blob Data Contributor" \
  --scope "$CONTAINER_SCOPE"

ServicePrincipal is the principal type Azure role assignments use for managed identities as well, so it is correct for a user-assigned managed identity; no client secret or certificate is involved.

The identity federated to system:serviceaccount:ate-system:atelet (the plugin in node mode) needs blob read/write access. The identity federated to system:serviceaccount:ate-system:ate-api-server (the plugin in control mode) needs blob read/write/delete access; the built-in role above covers both.

Deployment

Clone this repository and build and push the image:

KO_DOCKER_REPO=<registry> make build-image

The config/ component configures workload identity: it projects a service account token with audience api://AzureADTokenExchange into both sidecars and sets their AZURE_* variables, without a webhook mutating the whole Pod. Edit config/kustomization.yaml to set:

  • both example.invalid/replace-with-azure-blob-objectstore-plugin:latest image fields to the digest reference printed by make build-image;
  • both client IDs and the tenant ID;
  • the storage account URL;
  • the containers;
  • the optional storage prefix.

ate-setup has no option to add a component, so add this one, by its path relative to the overlay, to the overlay that ate-setup deploy ate-system renders in your substrate checkout: manifests/ate-install/base by default, or manifests/ate-install/kind with --kind. For example, with this repository cloned next to substrate, in manifests/ate-install/kind/kustomization.yaml:

components:
- ../../../../objectstore-azure-blob/config

To serve sandbox assets from blob containers as well, replace the REPLACE_WITH_ASSET_CONTAINERS placeholder in config/assets/kustomization.yaml with a comma-separated list of containers, grant the node identity read access to them, and list that component after the first:

components:
- ../../../../objectstore-azure-blob/config
- ../../../../objectstore-azure-blob/config/assets

A SandboxConfig version then names each asset by its blob URL and sha256, for example:

assets:
  amd64:
    kata-kernel:
      url: https://<account>.blob.core.windows.net/<container>/kata/vmlinux
      sha256: <sha256 of the blob>

Then install from the substrate repository root:

go run ./cmd/ate-setup deploy ate-system \
  --kind \
  --context <context> \
  --ko-docker-repo <registry> \
  --ko-default-platforms linux/amd64 \
  --credential-provider='{"name":"k8s.io"}' \
  --snapshot-location=azblob://<container>/<snapshot-root>/

--kind selects the kind overlay. It does not create a kind cluster, but it defaults several settings to a local kind setup, including the context, registry, and build platform, so name all three for any other cluster. It also defaults the snapshot location to gs://ate-snapshots/, which this plugin rejects, so set --snapshot-location on kind too.

On any other cluster, ate-setup currently installs for GKE: deploy ate-system refuses to start without --snapshot-transfer-gsa-name and --gcp-project-id, which configure the GCS credential exchange this plugin replaces. The plugin reads neither.

Only deploy ate-system renders that overlay. deploy atelet and deploy apiserver apply their manifests without it, which puts the base objectstore-plugin sidecars back, so redeploy with deploy ate-system.

The component changes only the sidecars. atelet and ate-api-server have no object storage settings of their own. atelet still needs the node's kubelet image credential provider from the chosen overlay to pull private actor images: base uses GKE's credential provider paths, and the kind overlay pulls actor images without credentials.

Snapshot location

ate-api-server stores snapshots under --snapshot-location, which must be an azblob:// URI in one of the configured containers. With the PerTemplateSnapshotLocation preview gate, an ActorTemplate's snapshotConfig.storageLocation overrides it and must meet the same rule. Without the gate, ate-api-server ignores that field. See Snapshot storage.

Error behavior

Condition gRPC code
Invalid URI, local path, or file list InvalidArgument
Requested blob absent during fetch NotFound
Configured container absent (cleanup succeeds instead) FailedPrecondition
Empty copy source FailedPrecondition
Azure Storage returns HTTP 401 or 403 PermissionDenied
Azure throttling, timeout, or server failure Unavailable
Connection failure, DNS server failure, or DNS timeout after the SDK's retries, or a download that fails after resuming Unavailable
Storage request that makes no progress for one minute (sending, awaiting the response, or one body read), after the SDK's retries Unavailable
Unknown storage account host name Internal
Microsoft Entra token request throttled, timed out, failed with a server error, or got no response Unavailable
Microsoft Entra rejects the token request Internal
Blob replaced while a download was resuming Unavailable
Context canceled or deadline exceeded Canceled / DeadlineExceeded
SHA-256 metadata absent, invalid, or mismatched DataLoss
Other local or Azure failures Internal

FetchAsset differs where its codes carry a narrower meaning: PermissionDenied means a refused snapshot location, so an Azure 401 or 403 is Internal; an absent asset container is NotFound; and a size or sha256 mismatch is FailedPrecondition. A 401 or 403 refuses the plugin's own identity, not the URL; atelet reads an asset anonymously after Internal only for gs:// URLs, which this plugin never reads.

Limitations and open edges

  • atelet sends an actor_jwt with every snapshot transfer. The plugin ignores it and does not authorize per actor: the node identity can read and write every snapshot in the configured containers and prefix.
  • A failed staged-block upload can leave uncommitted blocks. Azure expires uncommitted blocks after seven days. CleanupSnapshot deletes committed blobs under the caller-selected prefix; Azure does not expose uncommitted blocks through prefix listing.
  • Native Azure blob snapshots of blobs in the configured --containers block actor snapshot deletion until the operator removes them (CleanupSnapshot fails with Internal, Azure error SnapshotsPresent); the plugin never deletes them itself.
  • A file is staged in 4 MiB blocks, or, above 50,000 such blocks (about 195 GiB), in blocks of its size divided by 50,000, rounded up to a whole MiB. One file can therefore reach Azure's block blob limit of 50,000 blocks of 4,000 MiB (about 190.7 TiB). UploadSnapshot refuses a request holding a larger file with InvalidArgument before it stages any block.
  • UploadSnapshot reads each block of a file twice: once to hash it, through a 1 MiB buffer, and once, from the file, as the SDK sends it. It stages up to eight blocks at once and holds no block in memory, whatever the block size. Azure checks each block against the MD5 of the first read, so a block that changes between the two reads fails the upload.
  • CopySnapshot holds each source block in memory until it is staged, at most 32 MiB at once, when blocks are up to 32 MiB (blobs up to about 1.5 TiB). Larger blocks are staged from a second, ranged download of the source, like file blocks, so a copy holds no more than 32 MiB of block data at any size.
  • These bounds are per RPC, not process-wide, so concurrent uploads and copies multiply the memory use, and each block in flight also holds the HTTP client's buffers.
  • One plugin process is confined to one storage account and the containers in --containers. Copying snapshots across accounts is not supported.

Development

make build
make test
make verify
make fmt

The integration tests use the real Azure Blob SDK and the gRPC services over a Unix socket, against Azurite. They fail rather than skip when their Azurite configuration is absent. make test-integration runs hack/test-azurite.sh, which starts a pinned Azurite image with Docker on 127.0.0.1:${AZURITE_PORT:-10000}, runs every test in the module with the integration tag and -race, and removes the container; PR CI runs the same script.

The test uploads and restores a 320 MiB file with distinct per-block patterns, retries a partial block upload, verifies corrupt data is rejected, exercises concurrent uploads, and checks both control RPCs. Another uploads and copies blocks larger than 32 MiB, which are streamed rather than buffered.

The import-boundary test rejects imports of substrate packages outside api/ and pkg/.

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages