Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(fleets): per-claim secret env for in-guest daemons (cua-env-driver token) (#7885)

ddupont37212d264504
diff --git a/libs/fleet/backend/auth/authz_k8s.rego b/libs/fleet/backend/auth/authz_k8s.rego
index bd65dfcb6a..26c336fe60 100644
--- a/libs/fleet/backend/auth/authz_k8s.rego
+++ b/libs/fleet/backend/auth/authz_k8s.rego
@@ -332,6 +332,50 @@ is_write_method {
input.method == "DELETE"
}
+# ── Tenant Secrets ──────────────────────────────────────────────────────────
+#
+# api/v1/namespaces/{ns}/secrets (POST) and .../secrets/<tenant secret> (DELETE)
+#
+# The Secret kinds a tenant may write, one name prefix each:
+# * cua-claim-*: the SDK's per-claim secret. It names it in
+# OSGymSandboxClaim spec.secretRef, and the pool-operator delivers its
+# keys into the bound sandbox (the cua-env-driver token at
+# /run/cua/env-token; osgym/pool-operator/claim_secrets.py).
+# A reviewed product decision, not observed traffic. Write-only by design: no
+# GET, LIST, WATCH, PUT or PATCH on any Secret, so a tenant cannot read back
+# even its own Secrets, and cannot touch any Secret outside these prefixes
+# (the ECR pull secret, the OIDC credentials, the operator's
+# osgym-claim-secrets-* delivery Secrets). A POST names its object in the
+# body, so the per-kind name, type and payload checks for creation live in
+# tenant_secret_admission.rego, a conjunct on this surface. Capsule scopes the
+# caller to their own namespaces, as everywhere else here.
+#
+# Adding a kind: add its pattern here and in tenant_secret_admission.rego
+# (tenant_secret_admission_test.rego checks the two sets agree).
+tenant_secret_name_pattern[pattern] {
+ pattern := `^cua-claim-[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
+}
+
+k8s_request_allowed {
+ parts := split(input.params.path, "/")
+ core_namespaced_resource(parts, "secrets")
+ count(parts) == 5
+ input.method == "POST"
+}
+
+k8s_request_allowed {
+ parts := split(input.params.path, "/")
+ core_namespaced_resource(parts, "secrets")
+ count(parts) == 6
+ is_tenant_secret_name(parts[5])
+ input.method == "DELETE"
+}
+
+is_tenant_secret_name(name) {
+ count(name) <= 253
+ regex.match(tenant_secret_name_pattern[_], name)
+}
+
# ── Pod metrics ─────────────────────────────────────────────────────────────
#
# apis/metrics.k8s.io/v1beta1/namespaces/{ns}/pods — the CPU/memory numbers
diff --git a/libs/fleet/backend/auth/authz_k8s_test.rego b/libs/fleet/backend/auth/authz_k8s_test.rego
index 46323e370a..e96cd7ba80 100644
--- a/libs/fleet/backend/auth/authz_k8s_test.rego
+++ b/libs/fleet/backend/auth/authz_k8s_test.rego
@@ -721,6 +721,42 @@ test_core_writes_denied if {
not route_allow with input as spa_request("POST", "api/v1/namespaces/ns-a/persistentvolumeclaims")
}
+# Claim secrets: create on the collection (the body's cua-claim-* name is
+# checked by tenant_secret_admission.rego) and delete by a cua-claim-* name.
+# Nothing else on Secrets is reachable, including reading back a claim secret.
+test_claim_secret_create_and_delete_allowed if {
+ route_allow with input as spa_request("POST", "api/v1/namespaces/ns-a/secrets")
+ route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a")
+
+ user_key := object.union(
+ spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a"),
+ {"user": {"sub": "user-1", "azp": "ukey-abc", "namespace": "", "email": ""}},
+ )
+ route_allow with input as user_key
+}
+
+test_claim_secret_surface_is_write_only_and_prefix_bound if {
+ not route_allow with input as spa_request("GET", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a")
+ not route_allow with input as spa_request("PUT", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a")
+ not route_allow with input as spa_request("PATCH", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a")
+ not route_allow with input as spa_request("POST", "api/v1/namespaces/ns-a/secrets/cua-claim-claim-a")
+ not route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets")
+ not route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/ecr-credentials")
+ not route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/osgym-claim-secrets-sandbox-1")
+ not route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/cua-claim-")
+ not route_allow with input as spa_request("DELETE", "api/v1/namespaces/ns-a/secrets/cua-claim-x/extra")
+ not route_allow with input as spa_request("GET", "api/v1/watch/namespaces/ns-a/secrets")
+ not route_allow with input as spa_request("POST", "api/v1/secrets")
+}
+
+test_github_oidc_cannot_write_claim_secrets if {
+ request := object.union(
+ spa_request("POST", "api/v1/namespaces/ns-a/secrets"),
+ {"user": {"sub": "repo:org/repo", "azp": "github", "principal_type": "github_oidc", "allowed_namespaces": ["ns-a"]}},
+ )
+ not route_allow with input as request
+}
+
# Sandbox reads are customer-facing, but sandbox writes and unknown verbs stay
# outside the allowlist.
test_unenumerated_resource_and_verb_denied if {
diff --git a/libs/fleet/backend/auth/middlewares.go b/libs/fleet/backend/auth/middlewares.go
index 4e6e98391f..4d0fca8686 100644
--- a/libs/fleet/backend/auth/middlewares.go
+++ b/libs/fleet/backend/auth/middlewares.go
@@ -59,6 +59,15 @@ var customResourceCreationAdmissionPolicy string
//go:embed sandbox_services_admission.rego
var sandboxServicesAdmissionPolicy string
+// tenantSecretAdmissionPolicy restricts the one Secret create /api/k8s admits
+// (POST on the secrets collection) to the tenant Secret kinds, each under its
+// own name prefix (today cua-claim-*, the per-claim secret the pool-operator
+// delivers into a bound sandbox). One module for every kind, so kinds never
+// deny each other. A conjunct on the k8s surface, registered by name below.
+//
+//go:embed tenant_secret_admission.rego
+var tenantSecretAdmissionPolicy string
+
//go:embed image_admission.rego
var imageAdmissionPolicy string
@@ -400,6 +409,7 @@ func LoadOpa() {
RegisterPolicyModule("pool-admission", "pool_admission.rego", poolAdmissionPolicy)
RegisterPolicyModule("custom-resource-creation-admission", "custom_resource_creation_admission.rego", customResourceCreationAdmissionPolicy)
RegisterPolicyModule("sandbox-services-admission", "sandbox_services_admission.rego", sandboxServicesAdmissionPolicy)
+ RegisterPolicyModule("tenant-secret-admission", "tenant_secret_admission.rego", tenantSecretAdmissionPolicy)
RegisterPolicyModule("image-admission", "image_admission.rego", imageAdmissionPolicy)
RegisterPolicyModule("image-rollout", "image_rollout.rego", imageRolloutPolicy)
RegisterPolicyModule("authz-ownership", "authz_ownership.rego", authzOwnershipPolicy)
diff --git a/libs/fleet/backend/auth/policy_routes.go b/libs/fleet/backend/auth/policy_routes.go
index 9fcbd5263b..c4b2562789 100644
--- a/libs/fleet/backend/auth/policy_routes.go
+++ b/libs/fleet/backend/auth/policy_routes.go
@@ -199,10 +199,11 @@ func ImageRolloutPolicy() Node {
}
// K8sRoutePolicy guards /api/k8s/{path...}. It is the same base + surface shape
-// as every other route, with Image namespace ownership and four admission conjuncts: card-or-admin admission
-// for custom-resource creation, pool admission over the request body, and
+// as every other route, with Image namespace ownership and five admission conjuncts: card-or-admin admission
+// for custom-resource creation, pool admission over the request body,
// sandbox-services admission over the body of the one Sandbox write the
-// allowlist admits, plus Image admission excluding status and mismatched identity.
+// allowlist admits, tenant-secret admission over the body of the one Secret
+// create it admits, plus Image admission excluding status and mismatched identity.
//
// Every conjunct must pass. The three body-reading leaves read the raw body
// (bounded at 1 MiB) to inspect the object being created or patched, which is
@@ -243,6 +244,11 @@ const ServiceWriteNotSupportedMessage = "creating or modifying Kubernetes Servic
// strays outside the one field clients may write.
const SandboxPatchRestrictedMessage = "a sandbox PATCH may only modify spec.vmTemplate.services (an optional metadata.resourceVersion precondition is also accepted)"
+// TenantSecretRestrictedMessage is the 403 body when a Secret create through
+// /api/k8s is not one of the tenant Secret kinds (tenant_secret_admission.rego).
+// A new kind appends its own "; <kind>: ..." clause.
+const TenantSecretRestrictedMessage = "only tenant Secrets may be created through this API, in the path's namespace, with no generateName, annotations or ownerReferences. Claim secrets: a plain Opaque Secret named cua-claim-<name>, referenced from OSGymSandboxClaim spec.secretRef."
+
func K8sRoutePolicy() Node {
return All(
BasePolicy(),
@@ -279,6 +285,14 @@ func K8sRoutePolicy() Node {
),
SandboxPatchRestrictedMessage,
),
+ Because(
+ Policy(
+ Registered("tenant-secret-admission"),
+ Query("data.tenant_secret_admission.allow"),
+ WithRawBody(1<<20),
+ ),
+ TenantSecretRestrictedMessage,
+ ),
)
}
diff --git a/libs/fleet/backend/auth/policy_tenant_secret_test.go b/libs/fleet/backend/auth/policy_tenant_secret_test.go
new file mode 100644
index 0000000000..72c09cd78d
--- /dev/null
+++ b/libs/fleet/backend/auth/policy_tenant_secret_test.go
@@ -0,0 +1,79 @@
+package auth
+
+import (
+ "net/http"
+ "testing"
+)
+
+// These pin the per-claim secret surface end to end through the production
+// tree: the SDK may create a plain Opaque cua-claim-* Secret and delete it by
+// name, a create that is anything else 403s with its own message, and no other
+// Secret operation reaches the apiserver.
+
+const claimSecretCollection = "api/v1/namespaces/ns-a/secrets"
+
+func TestK8sClaimSecretCreateAndDeleteAdmitted(t *testing.T) {
+ setCardAdmissionFlags(t, false)
+ const body = `{"apiVersion":"v1","kind":"Secret","type":"Opaque","metadata":{"name":"cua-claim-claim-a","labels":{"osgym.cua.ai/claim":"claim-a"}},"stringData":{"env-token":"t"}}`
+
+ for _, testCase := range []struct {
+ name string
+ method string
+ path string
+ body string
+ }{
+ {name: "create", method: http.MethodPost, path: claimSecretCollection, body: body},
+ {name: "delete", method: http.MethodDelete, path: claimSecretCollection + "/cua-claim-claim-a"},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ response, reached := runK8sPolicyResponse(t, sandboxServicesRequest(testCase.method, testCase.path, testCase.body))
+ if response.Code != http.StatusNoContent || !reached {
+ t.Fatalf("status, reached = %d, %v; want %d, true", response.Code, reached, http.StatusNoContent)
+ }
+ })
+ }
+}
+
+func TestK8sNonClaimSecretCreateReturnsRestrictedMessage(t *testing.T) {
+ setCardAdmissionFlags(t, false)
+ for _, testCase := range []struct {
+ name string
+ body string
+ }{
+ {name: "other name", body: `{"metadata":{"name":"workload-oidc"},"stringData":{"client_id":"x"}}`},
+ {name: "generate name", body: `{"metadata":{"generateName":"cua-claim-"}}`},
+ {name: "service account token", body: `{"type":"kubernetes.io/service-account-token","metadata":{"name":"cua-claim-x","annotations":{"kubernetes.io/service-account.name":"default"}}}`},
+ } {
+ t.Run(testCase.name, func(t *testing.T) {
+ response, reached := runK8sPolicyResponse(t, sandboxServicesRequest(http.MethodPost, claimSecretCollection, testCase.body))
+ if response.Code != http.StatusForbidden || reached {
+ t.Fatalf("status, reached = %d, %v; want %d, false", response.Code, reached, http.StatusForbidden)
+ }
+ if got := policyErrorMessage(t, response); got != TenantSecretRestrictedMessage {
+ t.Fatalf("error = %q, want %q", got, TenantSecretRestrictedMessage)
+ }
+ })
+ }
+}
+
+func TestK8sOtherSecretOperationsDenied(t *testing.T) {
+ setCardAdmissionFlags(t, false)
+ for _, testCase := range []struct {
+ method string
+ path string
+ }{
+ {method: http.MethodGet, path: claimSecretCollection},
+ {method: http.MethodGet, path: claimSecretCollection + "/cua-claim-claim-a"},
+ {method: http.MethodPatch, path: claimSecretCollection + "/cua-claim-claim-a"},
+ {method: http.MethodPut, path: claimSecretCollection + "/cua-claim-claim-a"},
+ {method: http.MethodDelete, path: claimSecretCollection + "/ecr-credentials"},
+ {method: http.MethodDelete, path: claimSecretCollection + "/osgym-claim-secrets-sandbox-1"},
+ } {
+ t.Run(testCase.method+" "+testCase.path, func(t *testing.T) {
+ response, reached := runK8sPolicyResponse(t, sandboxServicesRequest(testCase.method, testCase.path, `{"stringData":{"a":"b"}}`))
+ if response.Code != http.StatusForbidden || reached {
+ t.Fatalf("status, reached = %d, %v; want %d, false", response.Code, reached, http.StatusForbidden)
+ }
+ })
+ }
+}
diff --git a/libs/fleet/backend/auth/policy_test.go b/libs/fleet/backend/auth/policy_test.go
index 3561b42bc6..85d23f4662 100644
--- a/libs/fleet/backend/auth/policy_test.go
+++ b/libs/fleet/backend/auth/policy_test.go
@@ -37,6 +37,7 @@ func TestRouteModulesNeverReadInputFacts(t *testing.T) {
"authz.rego": authzPolicy,
"pool_admission.rego": poolAdmissionPolicy,
"sandbox_services_admission.rego": sandboxServicesAdmissionPolicy,
+ "tenant_secret_admission.rego": tenantSecretAdmissionPolicy,
"image_admission.rego": imageAdmissionPolicy,
"image_rollout.rego": imageRolloutPolicy,
}
diff --git a/libs/fleet/backend/auth/tenant_secret_admission.rego b/libs/fleet/backend/auth/tenant_secret_admission.rego
new file mode 100644
index 0000000000..56a56a490a
--- /dev/null
+++ b/libs/fleet/backend/auth/tenant_secret_admission.rego
@@ -0,0 +1,151 @@
+# Admission over the request body for every Secret write /api/k8s admits.
+#
+# Tenants may create a few kinds of Secret through the gateway, each under its
+# own name prefix. The allowlist (authz_k8s.rego) admits POST on the secrets
+# collection and DELETE on an item whose name matches one of the
+# tenant_secret_name_pattern entries. A POST names its object in the body, so
+# the name and type checks live here: the collection path alone would let a
+# tenant create any Secret in their namespace, including one the pool-operator
+# reads (the OIDC credentials Secret) or a service-account-token Secret the
+# token controller would fill with a live ServiceAccount credential.
+#
+# One module for all kinds, so the conjuncts never deny each other's Secrets:
+#
+# * envelope: the checks every tenant Secret shares (POST on the collection,
+# only apiVersion/kind/metadata/type/data/stringData, metadata only
+# name/namespace/labels, no generateName/annotations/ownerReferences/
+# finalizers, namespace equal to the path's, string maps only);
+# * kind_admitted: one rule per kind. Each rule matches its own name prefix,
+# so kinds never overlap, and adds its type and payload checks.
+#
+# Adding a kind: add its name pattern to tenant_secret_name_pattern here AND in
+# authz_k8s.rego (tenant_secret_admission_test.rego checks both sets agree),
+# then add one kind_admitted rule below.
+#
+# Reads stay denied by the allowlist: tenant Secrets are write-only through the
+# gateway. `applies` matches every write on the secrets resource,
+# `allow { not applies }` passes the rest of the surface untouched, and
+# anything that applies but is not an admitted kind is denied, so a later
+# allowlist widening (PUT, PATCH) fails closed here.
+package tenant_secret_admission
+
+default allow = false
+
+# ── Kind name patterns ──────────────────────────────────────────────────────
+
+# Claim secrets: OSGymSandboxClaim spec.secretRef, delivered by the
+# pool-operator into the bound sandbox (osgym/pool-operator/claim_secrets.py).
+claim_secret_name_pattern := `^cua-claim-[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
+
+tenant_secret_name_pattern[pattern] {
+ pattern := claim_secret_name_pattern
+}
+
+# ── Kinds ───────────────────────────────────────────────────────────────────
+
+# Claim secret: a plain Opaque Secret (type omitted or "Opaque"), any string
+# keys. The pool-operator re-checks the type before delivering it.
+kind_admitted {
+ name_matches(claim_secret_name_pattern)
+ optional_equals(request_object, "type", "Opaque")
+}
+
+# ── Shared envelope ─────────────────────────────────────────────────────────
+
+write_method {
+ input.method == "POST"
+}
+
+write_method {
+ input.method == "PUT"
+}
+
+write_method {
+ input.method == "PATCH"
+}
+
+# api/v1/namespaces/{ns}/secrets[/{name}]
+secret_resource_path {
+ parts := split(input.params.path, "/")
+ count(parts) >= 5
+ count(parts) <= 6
+ parts[0] == "api"
+ parts[1] == "v1"
+ parts[2] == "namespaces"
+ parts[3] != ""
+ parts[4] == "secrets"
+}
+
+applies {
+ write_method
+ secret_resource_path
+}
+
+allow {
+ not applies
+}
+
+allow {
+ applies
+ envelope
+ kind_admitted
+}
+
+request_object := json.unmarshal(input.body) {
+ applies
+}
+
+allowed_top_level_keys := {"apiVersion", "kind", "metadata", "type", "data", "stringData"}
+
+allowed_metadata_keys := {"name", "namespace", "labels"}
+
+name_matches(pattern) {
+ name := request_object.metadata.name
+ is_string(name)
+ count(name) <= 253
+ regex.match(pattern, name)
+}
+
+optional_equals(obj, key, value) {
+ not has_key(obj, key)
+}
+
+optional_equals(obj, key, value) {
+ obj[key] == value
+}
+
+has_key(obj, key) {
+ _ = obj[key]
+}
+
+string_map_or_absent(obj, key) {
+ not has_key(obj, key)
+}
+
+string_map_or_absent(obj, key) {
+ value := obj[key]
+ is_object(value)
+ not non_string_value(value)
+}
+
+non_string_value(value) {
+ v := value[_]
+ not is_string(v)
+}
+
+envelope {
+ input.method == "POST"
+ parts := split(input.params.path, "/")
+ count(parts) == 5
+ is_object(request_object)
+ count(object.keys(request_object) - allowed_top_level_keys) == 0
+ optional_equals(request_object, "apiVersion", "v1")
+ optional_equals(request_object, "kind", "Secret")
+ metadata := request_object.metadata
+ is_object(metadata)
+ count(object.keys(metadata) - allowed_metadata_keys) == 0
+ optional_equals(metadata, "namespace", parts[3])
+ string_map_or_absent(metadata, "labels")
+ string_map_or_absent(request_object, "data")
+ string_map_or_absent(request_object, "stringData")
+}
diff --git a/libs/fleet/backend/auth/tenant_secret_admission_test.rego b/libs/fleet/backend/auth/tenant_secret_admission_test.rego
new file mode 100644
index 0000000000..5afc2bfb61
--- /dev/null
+++ b/libs/fleet/backend/auth/tenant_secret_admission_test.rego
@@ -0,0 +1,139 @@
+package tenant_secret_admission_test
+
+import data.authz_k8s
+import data.tenant_secret_admission
+
+collection_path := "api/v1/namespaces/ns-a/secrets"
+
+post(body) := {
+ "method": "POST",
+ "params": {"path": collection_path},
+ "body": body,
+}
+
+sdk_body := `{"apiVersion":"v1","kind":"Secret","type":"Opaque","metadata":{"name":"cua-claim-claim-a","namespace":"ns-a","labels":{"osgym.cua.ai/claim":"claim-a"}},"stringData":{"env-token":"t"}}`
+
+test_sdk_claim_secret_allowed {
+ tenant_secret_admission.allow with input as post(sdk_body)
+}
+
+test_minimal_claim_secret_allowed {
+ tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x"},"data":{"env-token":"dA=="}}`)
+}
+
+test_unrelated_request_allowed {
+ tenant_secret_admission.allow with input as {
+ "method": "POST",
+ "params": {"path": "apis/osgym.cua.ai/v1alpha1/namespaces/ns-a/osgymsandboxclaims"},
+ "body": "not json",
+ }
+}
+
+test_delete_passes_through_to_allowlist {
+ tenant_secret_admission.allow with input as {
+ "method": "DELETE",
+ "params": {"path": "api/v1/namespaces/ns-a/secrets/cua-claim-x"},
+ "body": "",
+ }
+}
+
+test_other_name_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"ecr-credentials"},"stringData":{"a":"b"}}`)
+}
+
+test_oidc_credentials_name_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"workload-oidc"},"stringData":{"client_id":"x"}}`)
+}
+
+test_bare_prefix_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-"}}`)
+}
+
+test_uppercase_name_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-X"}}`)
+}
+
+test_generate_name_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"generateName":"cua-claim-"}}`)
+}
+
+test_generate_name_alongside_name_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x","generateName":"cua-claim-"}}`)
+}
+
+test_service_account_token_type_denied {
+ not tenant_secret_admission.allow with input as post(`{"type":"kubernetes.io/service-account-token","metadata":{"name":"cua-claim-x","annotations":{"kubernetes.io/service-account.name":"default"}}}`)
+}
+
+test_service_account_token_type_without_annotations_denied {
+ not tenant_secret_admission.allow with input as post(`{"type":"kubernetes.io/service-account-token","metadata":{"name":"cua-claim-x"}}`)
+}
+
+test_dockerconfig_type_denied {
+ not tenant_secret_admission.allow with input as post(`{"type":"kubernetes.io/dockerconfigjson","metadata":{"name":"cua-claim-x"}}`)
+}
+
+test_annotations_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x","annotations":{"a":"b"}}}`)
+}
+
+test_owner_references_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x","ownerReferences":[]}}`)
+}
+
+test_other_namespace_in_body_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x","namespace":"ns-b"}}`)
+}
+
+test_wrong_kind_denied {
+ not tenant_secret_admission.allow with input as post(`{"kind":"ConfigMap","metadata":{"name":"cua-claim-x"}}`)
+}
+
+test_extra_top_level_key_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x"},"immutable":true}`)
+}
+
+test_non_string_data_denied {
+ not tenant_secret_admission.allow with input as post(`{"metadata":{"name":"cua-claim-x"},"stringData":{"a":1}}`)
+}
+
+test_malformed_body_denied {
+ not tenant_secret_admission.allow with input as post("not json")
+}
+
+test_post_to_item_path_denied {
+ not tenant_secret_admission.allow with input as {
+ "method": "POST",
+ "params": {"path": "api/v1/namespaces/ns-a/secrets/cua-claim-x"},
+ "body": `{"metadata":{"name":"cua-claim-x"}}`,
+ }
+}
+
+test_put_and_patch_denied {
+ not tenant_secret_admission.allow with input as {
+ "method": "PUT",
+ "params": {"path": "api/v1/namespaces/ns-a/secrets/cua-claim-x"},
+ "body": `{"metadata":{"name":"cua-claim-x"}}`,
+ }
+ not tenant_secret_admission.allow with input as {
+ "method": "PATCH",
+ "params": {"path": "api/v1/namespaces/ns-a/secrets/cua-claim-x"},
+ "body": `{"stringData":{"env-token":"t"}}`,
+ }
+}
+
+# authz_k8s.rego admits DELETE by the same name patterns this module admits
+# creation under. A kind added to one set but not the other would be
+# creatable but not deletable (or the reverse).
+test_name_patterns_agree_with_allowlist {
+ authz_k8s.tenant_secret_name_pattern == tenant_secret_admission.tenant_secret_name_pattern
+ count(tenant_secret_admission.tenant_secret_name_pattern) > 0
+}
+
+# Kinds must not overlap: a kind's sample name matches exactly one pattern, so
+# only that kind's type and payload rules can admit it. Add a sample per kind.
+kind_sample_names := {"cua-claim-x"}
+
+test_each_kind_name_matches_exactly_one_pattern {
+ count({n | n := kind_sample_names[_]; count({p | p := tenant_secret_admission.tenant_secret_name_pattern[_]; regex.match(p, n)}) != 1}) == 0
+}
diff --git a/libs/fleet/backend/auth/testdata/k8s-route-plan.txt b/libs/fleet/backend/auth/testdata/k8s-route-plan.txt
index 5873130a03..69be6398fb 100644
--- a/libs/fleet/backend/auth/testdata/k8s-route-plan.txt
+++ b/libs/fleet/backend/auth/testdata/k8s-route-plan.txt
@@ -17,3 +17,5 @@ All
Leaf query=data.pool_admission.allow source=multi["registered:authz","registered:pool-admission"] body=1048576
Because reason="a sandbox PATCH may only modify spec.vmTemplate.services (an optional metadata.resourceVersion precondition is also accepted)"
Leaf query=data.sandbox_services_admission.allow source=registered:sandbox-services-admission body=1048576
+ Because reason="only tenant Secrets may be created through this API, in the path's namespace, with no generateName, annotations or ownerReferences. Claim secrets: a plain Opaque Secret named cua-claim-<name>, referenced from OSGymSandboxClaim spec.secretRef."
+ Leaf query=data.tenant_secret_admission.allow source=registered:tenant-secret-admission body=1048576
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
index 75b562eff1..359f086b45 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
@@ -724,12 +724,55 @@ func (_ FfiDestroyerClaimLifecycle) Destroy(value ClaimLifecycle) {
value.Destroy()
}
+// Reference to a claim-scoped Secret delivered into the bound sandbox. See
+// [`CLAIM_SECRET_NAME_PREFIX`].
+type ClaimSecretRef struct {
+ Name string
+}
+
+func (r *ClaimSecretRef) Destroy() {
+ FfiDestroyerString{}.Destroy(r.Name)
+}
+
+type FfiConverterClaimSecretRef struct{}
+
+var FfiConverterClaimSecretRefINSTANCE = FfiConverterClaimSecretRef{}
+
+func (c FfiConverterClaimSecretRef) Lift(rb RustBufferI) ClaimSecretRef {
+ return LiftFromRustBuffer[ClaimSecretRef](c, rb)
+}
+
+func (c FfiConverterClaimSecretRef) Read(reader io.Reader) ClaimSecretRef {
+ return ClaimSecretRef{
+ FfiConverterStringINSTANCE.Read(reader),
+ }
+}
+
+func (c FfiConverterClaimSecretRef) Lower(value ClaimSecretRef) C.RustBuffer {
+ return LowerIntoRustBuffer[ClaimSecretRef](c, value)
+}
+
+func (c FfiConverterClaimSecretRef) LowerExternal(value ClaimSecretRef) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[ClaimSecretRef](c, value))
+}
+
+func (c FfiConverterClaimSecretRef) Write(writer io.Writer, value ClaimSecretRef) {
+ FfiConverterStringINSTANCE.Write(writer, value.Name)
+}
+
+type FfiDestroyerClaimSecretRef struct{}
+
+func (_ FfiDestroyerClaimSecretRef) Destroy(value ClaimSecretRef) {
+ value.Destroy()
+}
+
type ClaimSpec struct {
SandboxTemplateRef SandboxTemplateRef
Warmpool *string
BindDeadline *uint32
Lifecycle *ClaimLifecycle
TtlSecondsAfterCreated *uint32
+ SecretRef *ClaimSecretRef
}
func (r *ClaimSpec) Destroy() {
@@ -738,6 +781,7 @@ func (r *ClaimSpec) Destroy() {
FfiDestroyerOptionalUint32{}.Destroy(r.BindDeadline)
FfiDestroyerOptionalClaimLifecycle{}.Destroy(r.Lifecycle)
FfiDestroyerOptionalUint32{}.Destroy(r.TtlSecondsAfterCreated)
+ FfiDestroyerOptionalClaimSecretRef{}.Destroy(r.SecretRef)
}
type FfiConverterClaimSpec struct{}
@@ -755,6 +799,7 @@ func (c FfiConverterClaimSpec) Read(reader io.Reader) ClaimSpec {
FfiConverterOptionalUint32INSTANCE.Read(reader),
FfiConverterOptionalClaimLifecycleINSTANCE.Read(reader),
FfiConverterOptionalUint32INSTANCE.Read(reader),
+ FfiConverterOptionalClaimSecretRefINSTANCE.Read(reader),
}
}
@@ -772,6 +817,7 @@ func (c FfiConverterClaimSpec) Write(writer io.Writer, value ClaimSpec) {
FfiConverterOptionalUint32INSTANCE.Write(writer, value.BindDeadline)
FfiConverterOptionalClaimLifecycleINSTANCE.Write(writer, value.Lifecycle)
FfiConverterOptionalUint32INSTANCE.Write(writer, value.TtlSecondsAfterCreated)
+ FfiConverterOptionalClaimSecretRefINSTANCE.Write(writer, value.SecretRef)
}
type FfiDestroyerClaimSpec struct{}
@@ -1336,6 +1382,7 @@ type VmTemplate struct {
Probes **PreservedJson
Services *[]SandboxService
Oidc *OidcConfig
+ ClaimSecrets *bool
}
func (r *VmTemplate) Destroy() {
@@ -1354,6 +1401,7 @@ func (r *VmTemplate) Destroy() {
FfiDestroyerOptionalPreservedJson{}.Destroy(r.Probes)
FfiDestroyerOptionalSequenceSandboxService{}.Destroy(r.Services)
FfiDestroyerOptionalOidcConfig{}.Destroy(r.Oidc)
+ FfiDestroyerOptionalBool{}.Destroy(r.ClaimSecrets)
}
type FfiConverterVmTemplate struct{}
@@ -1381,6 +1429,7 @@ func (c FfiConverterVmTemplate) Read(reader io.Reader) VmTemplate {
FfiConverterOptionalPreservedJsonINSTANCE.Read(reader),
FfiConverterOptionalSequenceSandboxServiceINSTANCE.Read(reader),
FfiConverterOptionalOidcConfigINSTANCE.Read(reader),
+ FfiConverterOptionalBoolINSTANCE.Read(reader),
}
}
@@ -1408,6 +1457,7 @@ func (c FfiConverterVmTemplate) Write(writer io.Writer, value VmTemplate) {
FfiConverterOptionalPreservedJsonINSTANCE.Write(writer, value.Probes)
FfiConverterOptionalSequenceSandboxServiceINSTANCE.Write(writer, value.Services)
FfiConverterOptionalOidcConfigINSTANCE.Write(writer, value.Oidc)
+ FfiConverterOptionalBoolINSTANCE.Write(writer, value.ClaimSecrets)
}
type FfiDestroyerVmTemplate struct{}
@@ -2036,6 +2086,47 @@ func (_ FfiDestroyerOptionalClaimLifecycle) Destroy(value *ClaimLifecycle) {
}
}
+type FfiConverterOptionalClaimSecretRef struct{}
+
+var FfiConverterOptionalClaimSecretRefINSTANCE = FfiConverterOptionalClaimSecretRef{}
+
+func (c FfiConverterOptionalClaimSecretRef) Lift(rb RustBufferI) *ClaimSecretRef {
+ return LiftFromRustBuffer[*ClaimSecretRef](c, rb)
+}
+
+func (_ FfiConverterOptionalClaimSecretRef) Read(reader io.Reader) *ClaimSecretRef {
+ if readInt8(reader) == 0 {
+ return nil
+ }
+ temp := FfiConverterClaimSecretRefINSTANCE.Read(reader)
+ return &temp
+}
+
+func (c FfiConverterOptionalClaimSecretRef) Lower(value *ClaimSecretRef) C.RustBuffer {
+ return LowerIntoRustBuffer[*ClaimSecretRef](c, value)
+}
+
+func (c FfiConverterOptionalClaimSecretRef) LowerExternal(value *ClaimSecretRef) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[*ClaimSecretRef](c, value))
+}
+
+func (_ FfiConverterOptionalClaimSecretRef) Write(writer io.Writer, value *ClaimSecretRef) {
+ if value == nil {
+ writeInt8(writer, 0)
+ } else {
+ writeInt8(writer, 1)
+ FfiConverterClaimSecretRefINSTANCE.Write(writer, *value)
+ }
+}
+
+type FfiDestroyerOptionalClaimSecretRef struct{}
+
+func (_ FfiDestroyerOptionalClaimSecretRef) Destroy(value *ClaimSecretRef) {
+ if value != nil {
+ FfiDestroyerClaimSecretRef{}.Destroy(*value)
+ }
+}
+
type FfiConverterOptionalOsGymSandboxClaimSandbox struct{}
var FfiConverterOptionalOsGymSandboxClaimSandboxINSTANCE = FfiConverterOptionalOsGymSandboxClaimSandbox{}
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.h b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.h
index 6dd859f3b6..fade805585 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.h
+++ b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.h
@@ -453,6 +453,11 @@ uint64_t uniffi_cyclops_sdk_schema_fn_constructor_vmtemplatebuilder_new(RustCall
RustBuffer uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build(uint64_t ptr, RustCallStatus *out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+uint64_t uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(uint64_t ptr, int8_t value, RustCallStatus *out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_COMMAND
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_COMMAND
uint64_t uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(uint64_t ptr, RustBuffer value, RustCallStatus *out_status
@@ -951,6 +956,12 @@ uint16_t uniffi_cyclops_sdk_schema_checksum_method_sandboxtemplaterefbuilder_nam
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_BUILD
uint16_t uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+uint16_t uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_COMMAND
diff --git a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
index 58399a33b1..adc77f3094 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.go
@@ -376,6 +376,15 @@ func uniffiCheckChecksums() {
// If this happens try cleaning and rebuilding your project
panic("fleet_sdk: UniFFI contract version mismatch")
}
+ {
+ checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
+ return C.uniffi_cyclops_sdk_checksum_func_claim_env_token_key()
+ })
+ if checksum != 8887 {
+ // If this happens try cleaning and rebuilding your project
+ panic("fleet_sdk: uniffi_cyclops_sdk_checksum_func_claim_env_token_key: UniFFI API checksum mismatch")
+ }
+ }
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_func_fleet_label_key()
@@ -443,7 +452,7 @@ func uniffiCheckChecksums() {
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim()
})
- if checksum != 20460 {
+ if checksum != 52233 {
// If this happens try cleaning and rebuilding your project
panic("fleet_sdk: uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim: UniFFI API checksum mismatch")
}
@@ -1399,6 +1408,9 @@ func (c FfiConverterAccessTokenProvider) register() {
type CyclopsClientInterface interface {
CreateClaim(request CreateClaimRequest) (Claim, error)
+ // Delete the claim and, when it references a claim-scoped Secret
+ // (`secret_files`), that Secret too. The pool-operator also owner-refs
+ // the Secret to the claim, so garbage collection is the backstop.
DeleteClaim(claim Claim) error
GetClaim(claim Claim) (Claim, error)
ListClaims(namespace string) ([]Claim, error)
@@ -1590,6 +1602,9 @@ func (_self *CyclopsClient) CreateClaim(request CreateClaimRequest) (Claim, erro
return res, err
}
+// Delete the claim and, when it references a claim-scoped Secret
+// (`secret_files`), that Secret too. The pool-operator also owner-refs
+// the Secret to the claim, so garbage collection is the backstop.
func (_self *CyclopsClient) DeleteClaim(claim Claim) error {
_pointer := _self.ffiObject.incrementPointer("*CyclopsClient")
defer _self.ffiObject.decrementPointer()
@@ -3327,6 +3342,14 @@ type CreateClaimRequest struct {
// helpers (for example fleet fan-out) rely on this to tag related claims
// so they can be listed back by label within a namespace.
Labels *map[string]string
+ // Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ // 0600) once the claim binds, without restarting it. The key
+ // `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ // The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ // that the claim references by `spec.secretRef`; `delete_claim` removes
+ // it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ // never serialized with the request nor printed by `Debug`.
+ SecretFiles *map[string]string
}
func (r *CreateClaimRequest) Destroy() {
@@ -3334,6 +3357,7 @@ func (r *CreateClaimRequest) Destroy() {
FfiDestroyerOptionalClaimSpec{}.Destroy(r.Spec)
FfiDestroyerOptionalString{}.Destroy(r.Name)
FfiDestroyerOptionalMapStringString{}.Destroy(r.Labels)
+ FfiDestroyerOptionalMapStringString{}.Destroy(r.SecretFiles)
}
type FfiConverterCreateClaimRequest struct{}
@@ -3350,6 +3374,7 @@ func (c FfiConverterCreateClaimRequest) Read(reader io.Reader) CreateClaimReques
FfiConverterOptionalClaimSpecINSTANCE.Read(reader),
FfiConverterOptionalStringINSTANCE.Read(reader),
FfiConverterOptionalMapStringStringINSTANCE.Read(reader),
+ FfiConverterOptionalMapStringStringINSTANCE.Read(reader),
}
}
@@ -3366,6 +3391,7 @@ func (c FfiConverterCreateClaimRequest) Write(writer io.Writer, value CreateClai
FfiConverterOptionalClaimSpecINSTANCE.Write(writer, value.Spec)
FfiConverterOptionalStringINSTANCE.Write(writer, value.Name)
FfiConverterOptionalMapStringStringINSTANCE.Write(writer, value.Labels)
+ FfiConverterOptionalMapStringStringINSTANCE.Write(writer, value.SecretFiles)
}
type FfiDestroyerCreateClaimRequest struct{}
@@ -6665,6 +6691,16 @@ func fleet_sdk_uniffiFreeGorutine(data C.uint64_t) {
guard <- struct{}{}
}
+// The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+// that carries the cua-env-driver token for a claimed sandbox.
+func ClaimEnvTokenKey() string {
+ return FfiConverterStringINSTANCE.Lift(rustCall(func(_uniffiStatus *C.RustCallStatus) RustBufferI {
+ return GoRustBuffer{
+ inner: C.uniffi_cyclops_sdk_fn_func_claim_env_token_key(_uniffiStatus),
+ }
+ }))
+}
+
// The label key a fleet's claims share, for callers that filter or clean up
// with raw Kubernetes tooling instead of `list_fleet_claims`.
func FleetLabelKey() string {
diff --git a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
index 85845c432b..a0cf886665 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
+++ b/libs/fleet/sdk-bindings/go-uniffi/fleet_sdk/fleet_sdk.h
@@ -732,6 +732,11 @@ uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_name(uint64_t pt
uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool(uint64_t ptr, RustBuffer value, RustCallStatus *out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(uint64_t ptr, RustBuffer value, RustCallStatus *out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(uint64_t ptr, RustBuffer value, RustCallStatus *out_status
@@ -1027,6 +1032,12 @@ uint64_t uniffi_cyclops_sdk_fn_method_templatebuilder_metadata(uint64_t ptr, Rus
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_TEMPLATEBUILDER_SPEC
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_TEMPLATEBUILDER_SPEC
uint64_t uniffi_cyclops_sdk_fn_method_templatebuilder_spec(uint64_t ptr, RustBuffer value, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_CLAIM_ENV_TOKEN_KEY
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_CLAIM_ENV_TOKEN_KEY
+RustBuffer uniffi_cyclops_sdk_fn_func_claim_env_token_key(RustCallStatus *out_status
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_FLEET_LABEL_KEY
@@ -1322,6 +1333,12 @@ void ffi_cyclops_sdk_rust_future_free_void(uint64_t handle
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
#define UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
void ffi_cyclops_sdk_rust_future_complete_void(uint64_t handle, RustCallStatus *out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_CLAIM_ENV_TOKEN_KEY
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_CLAIM_ENV_TOKEN_KEY
+uint16_t uniffi_cyclops_sdk_checksum_func_claim_env_token_key(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_FLEET_LABEL_KEY
@@ -1628,6 +1645,12 @@ uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_name(void
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
index b38500057a..b968213b7f 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/fleet_sdk.kt
@@ -705,6 +705,8 @@ internal object IntegrityCheckingUniffiLib {
uniffiCheckContractApiVersion(this)
uniffiCheckApiChecksums(this)
}
+ external fun uniffi_cyclops_sdk_checksum_func_claim_env_token_key(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_func_fleet_label_key(
): Short
external fun uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status(
@@ -807,6 +809,8 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool(
): Short
+ external fun uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files(
+ ): Short
external fun uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec(
): Short
external fun uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_build(
@@ -1054,6 +1058,8 @@ external fun uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_name(`ptr`:
): Long
external fun uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
+external fun uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
+): Long
external fun uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(`ptr`: Long,`value`: RustBufferClaimSpec.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
external fun uniffi_cyclops_sdk_fn_clone_createpoolrequestbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -1170,6 +1176,8 @@ external fun uniffi_cyclops_sdk_fn_method_templatebuilder_metadata(`ptr`: Long,`
): Long
external fun uniffi_cyclops_sdk_fn_method_templatebuilder_spec(`ptr`: Long,`value`: RustBufferOSGymSandboxTemplateSpec.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
+external fun uniffi_cyclops_sdk_fn_func_claim_env_token_key(uniffi_out_err: UniffiRustCallStatus,
+): RustBuffer.ByValue
external fun uniffi_cyclops_sdk_fn_func_fleet_label_key(uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
external fun uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(uniffi_out_err: UniffiRustCallStatus,
@@ -1301,6 +1309,9 @@ private fun uniffiCheckContractApiVersion(lib: IntegrityCheckingUniffiLib) {
}
@Suppress("UNUSED_PARAMETER")
private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
+ if (lib.uniffi_cyclops_sdk_checksum_func_claim_env_token_key() != 8887.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_func_fleet_label_key() != 5219.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -1322,7 +1333,7 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim() != 23330.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
- if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 20460.toShort()) {
+ if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 52233.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() != 17760.toShort()) {
@@ -1454,6 +1465,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool() != 7405.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files() != 54115.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() != 28263.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -2531,6 +2545,8 @@ public interface CreateClaimRequestBuilderInterface {
fun `pool`(`value`: Pool): CreateClaimRequestBuilder
+ fun `secretFiles`(`value`: Map<kotlin.String, kotlin.String>): CreateClaimRequestBuilder
+
fun `spec`(`value`: ClaimSpec): CreateClaimRequestBuilder
companion object
@@ -2693,6 +2709,19 @@ open class CreateClaimRequestBuilder: Disposable, AutoCloseable, CreateClaimRequ
}
+ override fun `secretFiles`(`value`: Map<kotlin.String, kotlin.String>): CreateClaimRequestBuilder {
+ return FfiConverterTypeCreateClaimRequestBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ it,
+ FfiConverterMapStringString.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
override fun `spec`(`value`: ClaimSpec): CreateClaimRequestBuilder {
return FfiConverterTypeCreateClaimRequestBuilder.lift(
callWithHandle {
@@ -4045,6 +4074,11 @@ public interface CyclopsClientInterface {
suspend fun `createClaim`(`request`: CreateClaimRequest): Claim
+ /**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
suspend fun `deleteClaim`(`claim`: Claim)
suspend fun `getClaim`(`claim`: Claim): Claim
@@ -4283,6 +4317,11 @@ open class CyclopsClient: Disposable, AutoCloseable, CyclopsClientInterface
}
+ /**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
@Throws(SdkException::class)
@Suppress("ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE")
override suspend fun `deleteClaim`(`claim`: Claim) {
@@ -6916,6 +6955,17 @@ data class CreateClaimRequest (
* so they can be listed back by label within a namespace.
*/
var `labels`: Map<kotlin.String, kotlin.String>? = null
+ ,
+ /**
+ * Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ * 0600) once the claim binds, without restarting it. The key
+ * `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ * The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ * that the claim references by `spec.secretRef`; `delete_claim` removes
+ * it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ * never serialized with the request nor printed by `Debug`.
+ */
+ var `secretFiles`: Map<kotlin.String, kotlin.String>? = null
){
@@ -6936,6 +6986,7 @@ public object FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer<CreateC
FfiConverterOptionalTypeClaimSpec.read(buf),
FfiConverterOptionalString.read(buf),
FfiConverterOptionalMapStringString.read(buf),
+ FfiConverterOptionalMapStringString.read(buf),
)
}
@@ -6943,7 +6994,8 @@ public object FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer<CreateC
FfiConverterTypePool.allocationSize(value.`pool`) +
FfiConverterOptionalTypeClaimSpec.allocationSize(value.`spec`) +
FfiConverterOptionalString.allocationSize(value.`name`) +
- FfiConverterOptionalMapStringString.allocationSize(value.`labels`)
+ FfiConverterOptionalMapStringString.allocationSize(value.`labels`) +
+ FfiConverterOptionalMapStringString.allocationSize(value.`secretFiles`)
)
override fun write(value: CreateClaimRequest, buf: ByteBuffer) {
@@ -6951,6 +7003,7 @@ public object FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer<CreateC
FfiConverterOptionalTypeClaimSpec.write(value.`spec`, buf)
FfiConverterOptionalString.write(value.`name`, buf)
FfiConverterOptionalMapStringString.write(value.`labels`, buf)
+ FfiConverterOptionalMapStringString.write(value.`secretFiles`, buf)
}
}
@@ -9421,6 +9474,20 @@ public object FfiConverterMapStringString: FfiConverterRustBuffer<Map<kotlin.Str
+ /**
+ * The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+ * that carries the cua-env-driver token for a claimed sandbox.
+ */ fun `claimEnvTokenKey`(): kotlin.String {
+ return FfiConverterString.lift(
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_fn_func_claim_env_token_key(
+
+ _status)
+}
+ )
+ }
+
+
/**
* The label key a fleet's claims share, for callers that filter or clean up
* with raw Kubernetes tooling instead of `list_fleet_claims`.
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
index fdcaa047b4..b586ecc49b 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
@@ -650,6 +650,8 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build(
): Short
+ external fun uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets(
+ ): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command(
): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_container_disk_image(
@@ -768,6 +770,8 @@ external fun uniffi_cyclops_sdk_schema_fn_constructor_vmtemplatebuilder_new(unif
): Long
external fun uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build(`ptr`: Long,uniffi_out_err: UniffiRustCallStatus,
): RustBuffer.ByValue
+external fun uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(`ptr`: Long,`value`: Byte,uniffi_out_err: UniffiRustCallStatus,
+): Long
external fun uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
external fun uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_container_disk_image(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
@@ -986,6 +990,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build() != 17867.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets() != 62567.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command() != 20371.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -2902,6 +2909,8 @@ public interface VmTemplateBuilderInterface {
fun `build`(): VmTemplate
+ fun `claimSecrets`(`value`: kotlin.Boolean): VmTemplateBuilder
+
fun `command`(`value`: List<kotlin.String>): VmTemplateBuilder
fun `containerDiskImage`(`value`: kotlin.String): VmTemplateBuilder
@@ -3053,6 +3062,19 @@ open class VmTemplateBuilder: Disposable, AutoCloseable, VmTemplateBuilderInterf
}
+ override fun `claimSecrets`(`value`: kotlin.Boolean): VmTemplateBuilder {
+ return FfiConverterTypeVmTemplateBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ it,
+ FfiConverterBoolean.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
override fun `command`(`value`: List<kotlin.String>): VmTemplateBuilder {
return FfiConverterTypeVmTemplateBuilder.lift(
callWithHandle {
@@ -3635,6 +3657,43 @@ public object FfiConverterTypeClaimLifecycle: FfiConverterRustBuffer<ClaimLifecy
+/**
+ * Reference to a claim-scoped Secret delivered into the bound sandbox. See
+ * [`CLAIM_SECRET_NAME_PREFIX`].
+ */
+data class ClaimSecretRef (
+ var `name`: kotlin.String
+
+){
+
+
+
+
+
+ companion object
+}
+
+/**
+ * @suppress
+ */
+public object FfiConverterTypeClaimSecretRef: FfiConverterRustBuffer<ClaimSecretRef> {
+ override fun read(buf: ByteBuffer): ClaimSecretRef {
+ return ClaimSecretRef(
+ FfiConverterString.read(buf),
+ )
+ }
+
+ override fun allocationSize(value: ClaimSecretRef) = (
+ FfiConverterString.allocationSize(value.`name`)
+ )
+
+ override fun write(value: ClaimSecretRef, buf: ByteBuffer) {
+ FfiConverterString.write(value.`name`, buf)
+ }
+}
+
+
+
data class ClaimSpec (
var `sandboxTemplateRef`: SandboxTemplateRef
,
@@ -3645,6 +3704,8 @@ data class ClaimSpec (
var `lifecycle`: ClaimLifecycle?
,
var `ttlSecondsAfterCreated`: kotlin.UInt? = null
+ ,
+ var `secretRef`: ClaimSecretRef? = null
){
@@ -3666,6 +3727,7 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterOptionalUInt.read(buf),
FfiConverterOptionalTypeClaimLifecycle.read(buf),
FfiConverterOptionalUInt.read(buf),
+ FfiConverterOptionalTypeClaimSecretRef.read(buf),
)
}
@@ -3674,7 +3736,8 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterOptionalString.allocationSize(value.`warmpool`) +
FfiConverterOptionalUInt.allocationSize(value.`bindDeadline`) +
FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.`lifecycle`) +
- FfiConverterOptionalUInt.allocationSize(value.`ttlSecondsAfterCreated`)
+ FfiConverterOptionalUInt.allocationSize(value.`ttlSecondsAfterCreated`) +
+ FfiConverterOptionalTypeClaimSecretRef.allocationSize(value.`secretRef`)
)
override fun write(value: ClaimSpec, buf: ByteBuffer) {
@@ -3683,6 +3746,7 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterOptionalUInt.write(value.`bindDeadline`, buf)
FfiConverterOptionalTypeClaimLifecycle.write(value.`lifecycle`, buf)
FfiConverterOptionalUInt.write(value.`ttlSecondsAfterCreated`, buf)
+ FfiConverterOptionalTypeClaimSecretRef.write(value.`secretRef`, buf)
}
}
@@ -4222,6 +4286,8 @@ data class VmTemplate (
var `services`: List<SandboxService>?
,
var `oidc`: OidcConfig?
+ ,
+ var `claimSecrets`: kotlin.Boolean? = null
): Disposable{
@@ -4247,7 +4313,8 @@ data class VmTemplate (
this.`nestedVirtualization`,
this.`probes`,
this.`services`,
- this.`oidc`
+ this.`oidc`,
+ this.`claimSecrets`
)
}
@@ -4275,6 +4342,7 @@ public object FfiConverterTypeVmTemplate: FfiConverterRustBuffer<VmTemplate> {
FfiConverterOptionalTypePreservedJson.read(buf),
FfiConverterOptionalSequenceTypeSandboxService.read(buf),
FfiConverterOptionalTypeOidcConfig.read(buf),
+ FfiConverterOptionalBoolean.read(buf),
)
}
@@ -4293,7 +4361,8 @@ public object FfiConverterTypeVmTemplate: FfiConverterRustBuffer<VmTemplate> {
FfiConverterOptionalBoolean.allocationSize(value.`nestedVirtualization`) +
FfiConverterOptionalTypePreservedJson.allocationSize(value.`probes`) +
FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.`services`) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.`oidc`)
+ FfiConverterOptionalTypeOidcConfig.allocationSize(value.`oidc`) +
+ FfiConverterOptionalBoolean.allocationSize(value.`claimSecrets`)
)
override fun write(value: VmTemplate, buf: ByteBuffer) {
@@ -4312,6 +4381,7 @@ public object FfiConverterTypeVmTemplate: FfiConverterRustBuffer<VmTemplate> {
FfiConverterOptionalTypePreservedJson.write(value.`probes`, buf)
FfiConverterOptionalSequenceTypeSandboxService.write(value.`services`, buf)
FfiConverterOptionalTypeOidcConfig.write(value.`oidc`, buf)
+ FfiConverterOptionalBoolean.write(value.`claimSecrets`, buf)
}
}
@@ -4788,6 +4858,38 @@ public object FfiConverterOptionalTypeClaimLifecycle: FfiConverterRustBuffer<Cla
+/**
+ * @suppress
+ */
+public object FfiConverterOptionalTypeClaimSecretRef: FfiConverterRustBuffer<ClaimSecretRef?> {
+ override fun read(buf: ByteBuffer): ClaimSecretRef? {
+ if (buf.get().toInt() == 0) {
+ return null
+ }
+ return FfiConverterTypeClaimSecretRef.read(buf)
+ }
+
+ override fun allocationSize(value: ClaimSecretRef?): ULong {
+ if (value == null) {
+ return 1UL
+ } else {
+ return 1UL + FfiConverterTypeClaimSecretRef.allocationSize(value)
+ }
+ }
+
+ override fun write(value: ClaimSecretRef?, buf: ByteBuffer) {
+ if (value == null) {
+ buf.put(0)
+ } else {
+ buf.put(1)
+ FfiConverterTypeClaimSecretRef.write(value, buf)
+ }
+ }
+}
+
+
+
+
/**
* @suppress
*/
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
index 3720183b55..743928b87a 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
@@ -520,6 +520,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build() != 17867:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets() != 62567:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command() != 20371:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_container_disk_image() != 49021:
@@ -1002,6 +1004,12 @@ _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build.argtypes
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build.restype = _UniffiRustBuffer
+_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets.argtypes = (
+ ctypes.c_uint64,
+ ctypes.c_int8,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1185,6 +1193,9 @@ _UniffiLib.uniffi_cyclops_sdk_schema_checksum_constructor_vmtemplatebuilder_new.
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command.restype = ctypes.c_uint16
@@ -1399,6 +1410,40 @@ class _UniffiFfiConverterTypeClaimLifecycle(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalString.write(value.shutdown_policy, buf)
_UniffiFfiConverterOptionalBoolean.write(value.auto_renew, buf)
+@dataclass
+class ClaimSecretRef:
+ """
+ Reference to a claim-scoped Secret delivered into the bound sandbox. See
+ [`CLAIM_SECRET_NAME_PREFIX`].
+"""
+ def __init__(self, *, name:str):
+ self.name = name
+
+
+
+
+ def __str__(self):
+ return "ClaimSecretRef(name={})".format(self.name)
+ def __eq__(self, other):
+ if self.name != other.name:
+ return False
+ return True
+
+class _UniffiFfiConverterTypeClaimSecretRef(_UniffiConverterRustBuffer):
+ @staticmethod
+ def read(buf):
+ return ClaimSecretRef(
+ name=_UniffiFfiConverterString.read(buf),
+ )
+
+ @staticmethod
+ def check_lower(value):
+ _UniffiFfiConverterString.check_lower(value.name)
+
+ @staticmethod
+ def write(value, buf):
+ _UniffiFfiConverterString.write(value.name, buf)
+
@dataclass
class SandboxTemplateRef:
def __init__(self, *, name:str):
@@ -1492,9 +1537,34 @@ class _UniffiFfiConverterOptionalTypeClaimLifecycle(_UniffiConverterRustBuffer):
else:
raise InternalError("Unexpected flag byte for optional type")
+class _UniffiFfiConverterOptionalTypeClaimSecretRef(_UniffiConverterRustBuffer):
+ @classmethod
+ def check_lower(cls, value):
+ if value is not None:
+ _UniffiFfiConverterTypeClaimSecretRef.check_lower(value)
+
+ @classmethod
+ def write(cls, value, buf):
+ if value is None:
+ buf.write_u8(0)
+ return
+
+ buf.write_u8(1)
+ _UniffiFfiConverterTypeClaimSecretRef.write(value, buf)
+
+ @classmethod
+ def read(cls, buf):
+ flag = buf.read_u8()
+ if flag == 0:
+ return None
+ elif flag == 1:
+ return _UniffiFfiConverterTypeClaimSecretRef.read(buf)
+ else:
+ raise InternalError("Unexpected flag byte for optional type")
+
@dataclass
class ClaimSpec:
- def __init__(self, *, sandbox_template_ref:SandboxTemplateRef, warmpool:typing.Optional[str], bind_deadline:typing.Optional[int], lifecycle:typing.Optional[ClaimLifecycle], ttl_seconds_after_created:typing.Optional[int] = _DEFAULT):
+ def __init__(self, *, sandbox_template_ref:SandboxTemplateRef, warmpool:typing.Optional[str], bind_deadline:typing.Optional[int], lifecycle:typing.Optional[ClaimLifecycle], ttl_seconds_after_created:typing.Optional[int] = _DEFAULT, secret_ref:typing.Optional[ClaimSecretRef] = _DEFAULT):
self.sandbox_template_ref = sandbox_template_ref
self.warmpool = warmpool
self.bind_deadline = bind_deadline
@@ -1503,12 +1573,16 @@ class ClaimSpec:
self.ttl_seconds_after_created = None
else:
self.ttl_seconds_after_created = ttl_seconds_after_created
+ if secret_ref is _DEFAULT:
+ self.secret_ref = None
+ else:
+ self.secret_ref = secret_ref
def __str__(self):
- return "ClaimSpec(sandbox_template_ref={}, warmpool={}, bind_deadline={}, lifecycle={}, ttl_seconds_after_created={})".format(self.sandbox_template_ref, self.warmpool, self.bind_deadline, self.lifecycle, self.ttl_seconds_after_created)
+ return "ClaimSpec(sandbox_template_ref={}, warmpool={}, bind_deadline={}, lifecycle={}, ttl_seconds_after_created={}, secret_ref={})".format(self.sandbox_template_ref, self.warmpool, self.bind_deadline, self.lifecycle, self.ttl_seconds_after_created, self.secret_ref)
def __eq__(self, other):
if self.sandbox_template_ref != other.sandbox_template_ref:
return False
@@ -1520,6 +1594,8 @@ class ClaimSpec:
return False
if self.ttl_seconds_after_created != other.ttl_seconds_after_created:
return False
+ if self.secret_ref != other.secret_ref:
+ return False
return True
class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
@@ -1531,6 +1607,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
bind_deadline=_UniffiFfiConverterOptionalUInt32.read(buf),
lifecycle=_UniffiFfiConverterOptionalTypeClaimLifecycle.read(buf),
ttl_seconds_after_created=_UniffiFfiConverterOptionalUInt32.read(buf),
+ secret_ref=_UniffiFfiConverterOptionalTypeClaimSecretRef.read(buf),
)
@staticmethod
@@ -1540,6 +1617,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalUInt32.check_lower(value.bind_deadline)
_UniffiFfiConverterOptionalTypeClaimLifecycle.check_lower(value.lifecycle)
_UniffiFfiConverterOptionalUInt32.check_lower(value.ttl_seconds_after_created)
+ _UniffiFfiConverterOptionalTypeClaimSecretRef.check_lower(value.secret_ref)
@staticmethod
def write(value, buf):
@@ -1548,6 +1626,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalUInt32.write(value.bind_deadline, buf)
_UniffiFfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, buf)
_UniffiFfiConverterOptionalUInt32.write(value.ttl_seconds_after_created, buf)
+ _UniffiFfiConverterOptionalTypeClaimSecretRef.write(value.secret_ref, buf)
@dataclass
class OsGymSandboxClaimCondition:
@@ -2478,7 +2557,7 @@ class _UniffiFfiConverterOptionalTypeOidcConfig(_UniffiConverterRustBuffer):
@dataclass
class VmTemplate:
- def __init__(self, *, container_disk_image:str, command:typing.Optional[typing.List[str]], runtime:typing.Optional[RuntimeKind], runtime_class_name:typing.Optional[str], node_selector:typing.Optional[dict[str, str]], tolerations:typing.Optional[typing.List[PreservedJson]], image_pull_policy:typing.Optional[ImagePullPolicy], image_pull_secret:typing.Optional[str], cpu_cores:typing.Optional[int], memory:typing.Optional[str], firmware:typing.Optional[Firmware], nested_virtualization:typing.Optional[bool], probes:typing.Optional[PreservedJson], services:typing.Optional[typing.List[SandboxService]], oidc:typing.Optional[OidcConfig]):
+ def __init__(self, *, container_disk_image:str, command:typing.Optional[typing.List[str]], runtime:typing.Optional[RuntimeKind], runtime_class_name:typing.Optional[str], node_selector:typing.Optional[dict[str, str]], tolerations:typing.Optional[typing.List[PreservedJson]], image_pull_policy:typing.Optional[ImagePullPolicy], image_pull_secret:typing.Optional[str], cpu_cores:typing.Optional[int], memory:typing.Optional[str], firmware:typing.Optional[Firmware], nested_virtualization:typing.Optional[bool], probes:typing.Optional[PreservedJson], services:typing.Optional[typing.List[SandboxService]], oidc:typing.Optional[OidcConfig], claim_secrets:typing.Optional[bool] = _DEFAULT):
self.container_disk_image = container_disk_image
self.command = command
self.runtime = runtime
@@ -2494,12 +2573,16 @@ class VmTemplate:
self.probes = probes
self.services = services
self.oidc = oidc
+ if claim_secrets is _DEFAULT:
+ self.claim_secrets = None
+ else:
+ self.claim_secrets = claim_secrets
def __str__(self):
- return "VmTemplate(container_disk_image={}, command={}, runtime={}, runtime_class_name={}, node_selector={}, tolerations={}, image_pull_policy={}, image_pull_secret={}, cpu_cores={}, memory={}, firmware={}, nested_virtualization={}, probes={}, services={}, oidc={})".format(self.container_disk_image, self.command, self.runtime, self.runtime_class_name, self.node_selector, self.tolerations, self.image_pull_policy, self.image_pull_secret, self.cpu_cores, self.memory, self.firmware, self.nested_virtualization, self.probes, self.services, self.oidc)
+ return "VmTemplate(container_disk_image={}, command={}, runtime={}, runtime_class_name={}, node_selector={}, tolerations={}, image_pull_policy={}, image_pull_secret={}, cpu_cores={}, memory={}, firmware={}, nested_virtualization={}, probes={}, services={}, oidc={}, claim_secrets={})".format(self.container_disk_image, self.command, self.runtime, self.runtime_class_name, self.node_selector, self.tolerations, self.image_pull_policy, self.image_pull_secret, self.cpu_cores, self.memory, self.firmware, self.nested_virtualization, self.probes, self.services, self.oidc, self.claim_secrets)
def __eq__(self, other):
if self.container_disk_image != other.container_disk_image:
return False
@@ -2531,6 +2614,8 @@ class VmTemplate:
return False
if self.oidc != other.oidc:
return False
+ if self.claim_secrets != other.claim_secrets:
+ return False
return True
class _UniffiFfiConverterTypeVmTemplate(_UniffiConverterRustBuffer):
@@ -2552,6 +2637,7 @@ class _UniffiFfiConverterTypeVmTemplate(_UniffiConverterRustBuffer):
probes=_UniffiFfiConverterOptionalTypePreservedJson.read(buf),
services=_UniffiFfiConverterOptionalSequenceTypeSandboxService.read(buf),
oidc=_UniffiFfiConverterOptionalTypeOidcConfig.read(buf),
+ claim_secrets=_UniffiFfiConverterOptionalBoolean.read(buf),
)
@staticmethod
@@ -2571,6 +2657,7 @@ class _UniffiFfiConverterTypeVmTemplate(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypePreservedJson.check_lower(value.probes)
_UniffiFfiConverterOptionalSequenceTypeSandboxService.check_lower(value.services)
_UniffiFfiConverterOptionalTypeOidcConfig.check_lower(value.oidc)
+ _UniffiFfiConverterOptionalBoolean.check_lower(value.claim_secrets)
@staticmethod
def write(value, buf):
@@ -2589,6 +2676,7 @@ class _UniffiFfiConverterTypeVmTemplate(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypePreservedJson.write(value.probes, buf)
_UniffiFfiConverterOptionalSequenceTypeSandboxService.write(value.services, buf)
_UniffiFfiConverterOptionalTypeOidcConfig.write(value.oidc, buf)
+ _UniffiFfiConverterOptionalBoolean.write(value.claim_secrets, buf)
@dataclass
class OsGymSandboxSpec:
@@ -3471,6 +3559,8 @@ class VmTemplateBuilderProtocol(typing.Protocol):
def build(self, ) -> VmTemplate:
raise NotImplementedError
+ def claim_secrets(self, value: bool) -> VmTemplateBuilder:
+ raise NotImplementedError
def command(self, value: typing.List[str]) -> VmTemplateBuilder:
raise NotImplementedError
def container_disk_image(self, value: str) -> VmTemplateBuilder:
@@ -3546,6 +3636,21 @@ class VmTemplateBuilder(VmTemplateBuilderProtocol):
*_uniffi_lowered_args,
)
return _uniffi_lift_return(_uniffi_ffi_result)
+ def claim_secrets(self, value: bool) -> VmTemplateBuilder:
+
+ _UniffiFfiConverterBoolean.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterBoolean.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeVmTemplateBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def command(self, value: typing.List[str]) -> VmTemplateBuilder:
_UniffiFfiConverterSequenceString.check_lower(value)
@@ -3954,6 +4059,7 @@ __all__ = [
"JsonValueError",
"SchemaBuildError",
"ClaimLifecycle",
+ "ClaimSecretRef",
"SandboxTemplateRef",
"ClaimSpec",
"OsGymSandboxClaimCondition",
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
index 3f16c1c740..c0850aacf2 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_sdk.py
@@ -480,6 +480,8 @@ def _uniffi_check_contract_api_version(lib):
raise InternalError("UniFFI contract version mismatch: try cleaning and rebuilding your project")
def _uniffi_check_api_checksums(lib):
+ if lib.uniffi_cyclops_sdk_checksum_func_claim_env_token_key() != 8887:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_func_fleet_label_key() != 5219:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status() != 3094:
@@ -504,6 +506,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool() != 7405:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files() != 54115:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() != 28263:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new() != 33658:
@@ -576,7 +580,7 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key() != 9174:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
- if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 20460:
+ if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 52233:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_image() != 24680:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
@@ -1104,6 +1108,10 @@ _UniffiLib.uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient.argtypes = (
ctypes.POINTER(_UniffiVTableCallbackInterfaceFleetSdkHttpClient),
)
_UniffiLib.uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient.restype = None
+_UniffiLib.uniffi_cyclops_sdk_fn_func_claim_env_token_key.argtypes = (
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_func_claim_env_token_key.restype = _UniffiRustBuffer
_UniffiLib.uniffi_cyclops_sdk_fn_func_fleet_label_key.argtypes = (
ctypes.POINTER(_UniffiRustCallStatus),
)
@@ -1161,6 +1169,12 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool.argtypes
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files.argtypes = (
+ ctypes.c_uint64,
+ _UniffiRustBuffer,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec.argtypes = (
ctypes.c_uint64,
_UniffiRustBuffer,
@@ -1650,6 +1664,9 @@ _UniffiLib.uniffi_cyclops_sdk_fn_method_templatebuilder_spec.restype = ctypes.c_
_UniffiLib.ffi_cyclops_sdk_uniffi_contract_version.argtypes = (
)
_UniffiLib.ffi_cyclops_sdk_uniffi_contract_version.restype = ctypes.c_uint32
+_UniffiLib.uniffi_cyclops_sdk_checksum_func_claim_env_token_key.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_func_claim_env_token_key.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_func_fleet_label_key.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_func_fleet_label_key.restype = ctypes.c_uint16
@@ -1686,6 +1703,9 @@ _UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_name.res
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec.restype = ctypes.c_uint16
@@ -2449,7 +2469,7 @@ class _UniffiFfiConverterOptionalTypeClaimSpec(_UniffiConverterRustBuffer):
@dataclass
class CreateClaimRequest:
- def __init__(self, *, pool:Pool, spec:typing.Optional[fleet_sdk.ClaimSpec], name:typing.Optional[str] = _DEFAULT, labels:typing.Optional[dict[str, str]] = _DEFAULT):
+ def __init__(self, *, pool:Pool, spec:typing.Optional[fleet_sdk.ClaimSpec], name:typing.Optional[str] = _DEFAULT, labels:typing.Optional[dict[str, str]] = _DEFAULT, secret_files:typing.Optional[dict[str, str]] = _DEFAULT):
self.pool = pool
self.spec = spec
if name is _DEFAULT:
@@ -2460,12 +2480,16 @@ class CreateClaimRequest:
self.labels = None
else:
self.labels = labels
+ if secret_files is _DEFAULT:
+ self.secret_files = None
+ else:
+ self.secret_files = secret_files
def __str__(self):
- return "CreateClaimRequest(pool={}, spec={}, name={}, labels={})".format(self.pool, self.spec, self.name, self.labels)
+ return "CreateClaimRequest(pool={}, spec={}, name={}, labels={}, secret_files={})".format(self.pool, self.spec, self.name, self.labels, self.secret_files)
def __eq__(self, other):
if self.pool != other.pool:
return False
@@ -2475,6 +2499,8 @@ class CreateClaimRequest:
return False
if self.labels != other.labels:
return False
+ if self.secret_files != other.secret_files:
+ return False
return True
class _UniffiFfiConverterTypeCreateClaimRequest(_UniffiConverterRustBuffer):
@@ -2485,6 +2511,7 @@ class _UniffiFfiConverterTypeCreateClaimRequest(_UniffiConverterRustBuffer):
spec=_UniffiFfiConverterOptionalTypeClaimSpec.read(buf),
name=_UniffiFfiConverterOptionalString.read(buf),
labels=_UniffiFfiConverterOptionalMapStringString.read(buf),
+ secret_files=_UniffiFfiConverterOptionalMapStringString.read(buf),
)
@staticmethod
@@ -2493,6 +2520,7 @@ class _UniffiFfiConverterTypeCreateClaimRequest(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypeClaimSpec.check_lower(value.spec)
_UniffiFfiConverterOptionalString.check_lower(value.name)
_UniffiFfiConverterOptionalMapStringString.check_lower(value.labels)
+ _UniffiFfiConverterOptionalMapStringString.check_lower(value.secret_files)
@staticmethod
def write(value, buf):
@@ -2500,6 +2528,7 @@ class _UniffiFfiConverterTypeCreateClaimRequest(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalTypeClaimSpec.write(value.spec, buf)
_UniffiFfiConverterOptionalString.write(value.name, buf)
_UniffiFfiConverterOptionalMapStringString.write(value.labels, buf)
+ _UniffiFfiConverterOptionalMapStringString.write(value.secret_files, buf)
@dataclass
class CreatePoolRequest:
@@ -4680,6 +4709,8 @@ class CreateClaimRequestBuilderProtocol(typing.Protocol):
raise NotImplementedError
def pool(self, value: Pool) -> CreateClaimRequestBuilder:
raise NotImplementedError
+ def secret_files(self, value: dict[str, str]) -> CreateClaimRequestBuilder:
+ raise NotImplementedError
def spec(self, value: fleet_sdk.ClaimSpec) -> CreateClaimRequestBuilder:
raise NotImplementedError
@@ -4772,6 +4803,21 @@ class CreateClaimRequestBuilder(CreateClaimRequestBuilderProtocol):
*_uniffi_lowered_args,
)
return _uniffi_lift_return(_uniffi_ffi_result)
+ def secret_files(self, value: dict[str, str]) -> CreateClaimRequestBuilder:
+
+ _UniffiFfiConverterMapStringString.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterMapStringString.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeCreateClaimRequestBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def spec(self, value: fleet_sdk.ClaimSpec) -> CreateClaimRequestBuilder:
fleet_sdk._UniffiFfiConverterTypeClaimSpec.check_lower(value)
@@ -5524,6 +5570,11 @@ class CyclopsClientProtocol(typing.Protocol):
async def create_user_api_key(self, request: CreateUserApiKeyRequest) -> NewUserApiKey:
raise NotImplementedError
async def delete_claim(self, claim: Claim) -> None:
+ """
+ Delete the claim and, when it references a claim-scoped Secret
+ (`secret_files`), that Secret too. The pool-operator also owner-refs
+ the Secret to the claim, so garbage collection is the backstop.
+"""
raise NotImplementedError
async def delete_image(self, namespace: str,name: str) -> None:
raise NotImplementedError
@@ -5938,6 +5989,11 @@ class CyclopsClient(CyclopsClientProtocol):
_uniffi_error_converter,
)
async def delete_claim(self, claim: Claim) -> None:
+ """
+ Delete the claim and, when it references a claim-scoped Secret
+ (`secret_files`), that Secret too. The pool-operator also owner-refs
+ the Secret to the claim, so garbage collection is the backstop.
+"""
_UniffiFfiConverterTypeClaim.check_lower(claim)
_uniffi_lowered_args = (
@@ -7204,6 +7260,21 @@ class _UniffiFfiConverterUInt8(_UniffiConverterPrimitiveInt):
@staticmethod
def write(value, buf):
buf.write_u8(value)
+def claim_env_token_key() -> str:
+ """
+ The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+ that carries the cua-env-driver token for a claimed sandbox.
+"""
+ _uniffi_lowered_args = (
+ )
+ _uniffi_lift_return = _UniffiFfiConverterString.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_fn_func_claim_env_token_key,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
def fleet_label_key() -> str:
"""
The label key a fleet's claims share, for callers that filter or clean up
@@ -7313,6 +7384,7 @@ __all__ = [
"SignedServiceUrl",
"Template",
"UserApiKey",
+ "claim_env_token_key",
"fleet_label_key",
"healthy_pool_display_status",
"pool_display_status",
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
index 432bc48b22..84738aeacc 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
@@ -132,6 +132,25 @@ end
end
end
+ # The Record type ClaimSecretRef.
+
+ def self.check_lower_TypeClaimSecretRef(v)
+
+ end
+
+ def self.alloc_from_TypeClaimSecretRef(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_TypeClaimSecretRef(v)
+ return builder.finalize
+ end
+ end
+
+ def consumeIntoTypeClaimSecretRef
+ consumeWithStream do |stream|
+ return stream.readTypeClaimSecretRef
+ end
+ end
+
# The Record type ClaimSpec.
def self.check_lower_TypeClaimSpec(v)
@@ -140,6 +159,7 @@ end
RustBuffer.check_lower_Optionalu32(v.bind_deadline)
RustBuffer.check_lower_OptionalTypeClaimLifecycle(v.lifecycle)
RustBuffer.check_lower_Optionalu32(v.ttl_seconds_after_created)
+ RustBuffer.check_lower_OptionalTypeClaimSecretRef(v.secret_ref)
end
def self.alloc_from_TypeClaimSpec(v)
@@ -407,6 +427,7 @@ end
RustBuffer.check_lower_OptionalTypePreservedJson(v.probes)
RustBuffer.check_lower_OptionalSequenceTypeSandboxService(v.services)
RustBuffer.check_lower_OptionalTypeOidcConfig(v.oidc)
+ RustBuffer.check_lower_Optionalbool(v.claim_secrets)
end
def self.alloc_from_TypeVmTemplate(v)
@@ -628,6 +649,27 @@ end
end
end
+ # The Optional<T> type for TypeClaimSecretRef.
+
+ def self.check_lower_OptionalTypeClaimSecretRef(v)
+ if not v.nil?
+ RustBuffer.check_lower_TypeClaimSecretRef(v)
+ end
+ end
+
+ def self.alloc_from_OptionalTypeClaimSecretRef(v)
+ RustBuffer.allocWithBuilder do |builder|
+ builder.write_OptionalTypeClaimSecretRef(v)
+ return builder.finalize()
+ end
+ end
+
+ def consumeIntoOptionalTypeClaimSecretRef
+ consumeWithStream do |stream|
+ return stream.readOptionalTypeClaimSecretRef
+ end
+ end
+
# The Optional<T> type for TypeOSGymSandboxClaimSandbox.
def self.check_lower_OptionalTypeOSGymSandboxClaimSandbox(v)
@@ -1114,6 +1156,14 @@ class RustBufferStream
)
end
+ # The Record type ClaimSecretRef.
+
+ def readTypeClaimSecretRef
+ ClaimSecretRef.new(
+ name: readString
+ )
+ end
+
# The Record type ClaimSpec.
def readTypeClaimSpec
@@ -1122,7 +1172,8 @@ class RustBufferStream
warmpool: readOptionalstring,
bind_deadline: readOptionalu32,
lifecycle: readOptionalTypeClaimLifecycle,
- ttl_seconds_after_created: readOptionalu32
+ ttl_seconds_after_created: readOptionalu32,
+ secret_ref: readOptionalTypeClaimSecretRef
)
end
@@ -1257,7 +1308,8 @@ class RustBufferStream
nested_virtualization: readOptionalbool,
probes: readOptionalTypePreservedJson,
services: readOptionalSequenceTypeSandboxService,
- oidc: readOptionalTypeOidcConfig
+ oidc: readOptionalTypeOidcConfig,
+ claim_secrets: readOptionalbool
)
end
@@ -1462,6 +1514,20 @@ class RustBufferStream
end
end
+ # The Optional<T> type for TypeClaimSecretRef.
+
+ def readOptionalTypeClaimSecretRef
+ flag = unpack_from 1, 'c'
+
+ if flag == 0
+ return nil
+ elsif flag == 1
+ return readTypeClaimSecretRef
+ else
+ raise InternalError, 'Unexpected flag byte for OptionalTypeClaimSecretRef'
+ end
+ end
+
# The Optional<T> type for TypeOSGymSandboxClaimSandbox.
def readOptionalTypeOSGymSandboxClaimSandbox
@@ -1830,6 +1896,12 @@ class RustBufferBuilder
self.write_Optionalbool(v.auto_renew)
end
+ # The Record type ClaimSecretRef.
+
+ def write_TypeClaimSecretRef(v)
+ self.write_String(v.name)
+ end
+
# The Record type ClaimSpec.
def write_TypeClaimSpec(v)
@@ -1838,6 +1910,7 @@ class RustBufferBuilder
self.write_Optionalu32(v.bind_deadline)
self.write_OptionalTypeClaimLifecycle(v.lifecycle)
self.write_Optionalu32(v.ttl_seconds_after_created)
+ self.write_OptionalTypeClaimSecretRef(v.secret_ref)
end
# The Record type OSGymSandboxClaimCondition.
@@ -1949,6 +2022,7 @@ class RustBufferBuilder
self.write_OptionalTypePreservedJson(v.probes)
self.write_OptionalSequenceTypeSandboxService(v.services)
self.write_OptionalTypeOidcConfig(v.oidc)
+ self.write_Optionalbool(v.claim_secrets)
end
# The Record type WarmPoolAutoscaling.
@@ -2046,6 +2120,17 @@ class RustBufferBuilder
end
end
+ # The Optional<T> type for TypeClaimSecretRef.
+
+ def write_OptionalTypeClaimSecretRef(v)
+ if v.nil?
+ pack_into(1, 'c', 0)
+ else
+ pack_into(1, 'c', 1)
+ self.write_TypeClaimSecretRef(v)
+ end
+ end
+
# The Optional<T> type for TypeOSGymSandboxClaimSandbox.
def write_OptionalTypeOSGymSandboxClaimSandbox(v)
@@ -2445,6 +2530,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build,
[:uint64, RustCallStatus.by_ref],
RustBuffer.by_value
+ attach_function :uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets,
+ [:uint64, :int8, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
@@ -2595,6 +2683,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command,
[RustCallStatus.by_ref],
:uint16
@@ -2779,16 +2870,34 @@ class ClaimLifecycle
end
end
+ # Record type ClaimSecretRef
+class ClaimSecretRef
+ attr_reader :name
+
+ def initialize(name:)
+ @name = name
+ end
+
+ def ==(other)
+ if @name != other.name
+ return false
+ end
+
+ true
+ end
+end
+
# Record type ClaimSpec
class ClaimSpec
- attr_reader :sandbox_template_ref, :warmpool, :bind_deadline, :lifecycle, :ttl_seconds_after_created
+ attr_reader :sandbox_template_ref, :warmpool, :bind_deadline, :lifecycle, :ttl_seconds_after_created, :secret_ref
- def initialize(sandbox_template_ref:, warmpool:, bind_deadline:, lifecycle:, ttl_seconds_after_created: nil)
+ def initialize(sandbox_template_ref:, warmpool:, bind_deadline:, lifecycle:, ttl_seconds_after_created: nil, secret_ref: nil)
@sandbox_template_ref = sandbox_template_ref
@warmpool = warmpool
@bind_deadline = bind_deadline
@lifecycle = lifecycle
@ttl_seconds_after_created = ttl_seconds_after_created
+ @secret_ref = secret_ref
end
def ==(other)
@@ -2807,6 +2916,9 @@ class ClaimSpec
if @ttl_seconds_after_created != other.ttl_seconds_after_created
return false
end
+ if @secret_ref != other.secret_ref
+ return false
+ end
true
end
@@ -2968,9 +3080,9 @@ end
# Record type VmTemplate
class VmTemplate
- attr_reader :container_disk_image, :command, :runtime, :runtime_class_name, :node_selector, :tolerations, :image_pull_policy, :image_pull_secret, :cpu_cores, :memory, :firmware, :nested_virtualization, :probes, :services, :oidc
+ attr_reader :container_disk_image, :command, :runtime, :runtime_class_name, :node_selector, :tolerations, :image_pull_policy, :image_pull_secret, :cpu_cores, :memory, :firmware, :nested_virtualization, :probes, :services, :oidc, :claim_secrets
- def initialize(container_disk_image:, command:, runtime:, runtime_class_name:, node_selector:, tolerations:, image_pull_policy:, image_pull_secret:, cpu_cores:, memory:, firmware:, nested_virtualization:, probes:, services:, oidc:)
+ def initialize(container_disk_image:, command:, runtime:, runtime_class_name:, node_selector:, tolerations:, image_pull_policy:, image_pull_secret:, cpu_cores:, memory:, firmware:, nested_virtualization:, probes:, services:, oidc:, claim_secrets: nil)
@container_disk_image = container_disk_image
@command = command
@runtime = runtime
@@ -2986,6 +3098,7 @@ class VmTemplate
@probes = probes
@services = services
@oidc = oidc
+ @claim_secrets = claim_secrets
end
def ==(other)
@@ -3034,6 +3147,9 @@ class VmTemplate
if @oidc != other.oidc
return false
end
+ if @claim_secrets != other.claim_secrets
+ return false
+ end
true
end
@@ -3393,6 +3509,12 @@ end
result = CyclopsSdkSchema.rust_call_with_error(SchemaBuildError,:uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build,uniffi_clone_handle(),)
return result.consumeIntoTypeVmTemplate
end
+ def claim_secrets(value)
+ value = value ? true : false
+
+ result = CyclopsSdkSchema.rust_call(:uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets,uniffi_clone_handle(),(value ? 1 : 0))
+ return VmTemplateBuilder.uniffi_allocate(result)
+ end
def command(value)
value = value.map { |v| CyclopsSdkSchema::uniffi_utf8(v) }
RustBuffer.check_lower_Sequencestring(value)
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
index f501508125..d34c44d184 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/sdk.rb
@@ -199,6 +199,7 @@ private_constant :UniffiHandleMap
RustBuffer.check_lower_OptionalTypeClaimSpec(v.spec)
RustBuffer.check_lower_Optionalstring(v.name)
RustBuffer.check_lower_OptionalMapStringString(v.labels)
+ RustBuffer.check_lower_OptionalMapStringString(v.secret_files)
end
def self.alloc_from_TypeCreateClaimRequest(v)
@@ -1432,7 +1433,8 @@ class RustBufferStream
pool: readTypePool,
spec: readOptionalTypeClaimSpec,
name: readOptionalstring,
- labels: readOptionalMapStringString
+ labels: readOptionalMapStringString,
+ secret_files: readOptionalMapStringString
)
end
@@ -2375,6 +2377,7 @@ class RustBufferBuilder
self.write_OptionalTypeClaimSpec(v.spec)
self.write_Optionalstring(v.name)
self.write_OptionalMapStringString(v.labels)
+ self.write_OptionalMapStringString(v.secret_files)
end
# The Record type CreatePoolRequest.
@@ -3544,6 +3547,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files,
+ [:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
@@ -3718,6 +3724,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_fn_method_templatebuilder_spec,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_fn_func_claim_env_token_key,
+ [RustCallStatus.by_ref],
+ RustBuffer.by_value
attach_function :uniffi_cyclops_sdk_fn_func_fleet_label_key,
[RustCallStatus.by_ref],
RustBuffer.by_value
@@ -3748,6 +3757,9 @@ module UniFFILib
attach_function :ffi_cyclops_sdk_rustbuffer_reserve,
[RustBuffer.by_value, :uint64, RustCallStatus.by_ref],
RustBuffer.by_value
+ attach_function :uniffi_cyclops_sdk_checksum_func_claim_env_token_key,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_func_fleet_label_key,
[RustCallStatus.by_ref],
:uint16
@@ -3901,6 +3913,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec,
[RustCallStatus.by_ref],
:uint16
@@ -4297,13 +4312,14 @@ end
# Record type CreateClaimRequest
class CreateClaimRequest
- attr_reader :pool, :spec, :name, :labels
+ attr_reader :pool, :spec, :name, :labels, :secret_files
- def initialize(pool:, spec:, name: nil, labels: nil)
+ def initialize(pool:, spec:, name: nil, labels: nil, secret_files: nil)
@pool = pool
@spec = spec
@name = name
@labels = labels
+ @secret_files = secret_files
end
def ==(other)
@@ -4319,6 +4335,9 @@ class CreateClaimRequest
if @labels != other.labels
return false
end
+ if @secret_files != other.secret_files
+ return false
+ end
true
end
@@ -4870,6 +4889,15 @@ end
+def self.claim_env_token_key()
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_func_claim_env_token_key,)
+ return result.consumeIntoString
+end
+
+
+
+
+
def self.fleet_label_key()
result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_func_fleet_label_key,)
return result.consumeIntoString
@@ -5669,6 +5697,12 @@ end
result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool,uniffi_clone_handle(),RustBuffer.alloc_from_TypePool(value))
return CreateClaimRequestBuilder.uniffi_allocate(result)
end
+ def secret_files(value)
+ value = value.each.with_object({}) { |(k, v), res| res[FleetSdk::uniffi_utf8(k)] = FleetSdk::uniffi_utf8(v) }
+ RustBuffer.check_lower_MapStringString(value)
+ result = FleetSdk.rust_call(:uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files,uniffi_clone_handle(),RustBuffer.alloc_from_MapStringString(value))
+ return CreateClaimRequestBuilder.uniffi_allocate(result)
+ end
def spec(value)
value = value
RustBuffer.check_lower_TypeClaimSpec(value)
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
index 043b205748..13b3a399e9 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdk.swift
@@ -780,6 +780,8 @@ public protocol CreateClaimRequestBuilderProtocol: AnyObject, Sendable {
func pool(value: Pool) -> CreateClaimRequestBuilder
+ func secretFiles(value: [String: String]) -> CreateClaimRequestBuilder
+
func spec(value: ClaimSpec) -> CreateClaimRequestBuilder
}
@@ -878,6 +880,15 @@ open func pool(value: Pool) -> CreateClaimRequestBuilder {
})
}
+open func secretFiles(value: [String: String]) -> CreateClaimRequestBuilder {
+ return try! FfiConverterTypeCreateClaimRequestBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ self.uniffiCloneHandle(),
+ FfiConverterDictionaryStringString.lower(value),$0
+ )
+})
+}
+
open func spec(value: ClaimSpec) -> CreateClaimRequestBuilder {
return try! FfiConverterTypeCreateClaimRequestBuilder_lift(try! rustCall() {
uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(
@@ -1554,6 +1565,11 @@ public protocol CyclopsClientProtocol: AnyObject, Sendable {
func createClaim(request: CreateClaimRequest) async throws -> Claim
+ /**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
func deleteClaim(claim: Claim) async throws
func getClaim(claim: Claim) async throws -> Claim
@@ -1806,6 +1822,11 @@ open func createClaim(request: CreateClaimRequest)async throws -> Claim {
)
}
+ /**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
open func deleteClaim(claim: Claim)async throws {
return
try await uniffiRustCallAsync(
@@ -3499,6 +3520,16 @@ public struct CreateClaimRequest: Equatable, Hashable {
* so they can be listed back by label within a namespace.
*/
public var labels: [String: String]?
+ /**
+ * Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ * 0600) once the claim binds, without restarting it. The key
+ * `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ * The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ * that the claim references by `spec.secretRef`; `delete_claim` removes
+ * it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ * never serialized with the request nor printed by `Debug`.
+ */
+ public var secretFiles: [String: String]?
// Default memberwise initializers are never public by default, so we
// declare one manually.
@@ -3512,11 +3543,21 @@ public struct CreateClaimRequest: Equatable, Hashable {
* Labels stamped onto the created claim's metadata verbatim. Grouping
* helpers (for example fleet fan-out) rely on this to tag related claims
* so they can be listed back by label within a namespace.
- */labels: [String: String]? = nil) {
+ */labels: [String: String]? = nil,
+ /**
+ * Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ * 0600) once the claim binds, without restarting it. The key
+ * `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ * The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ * that the claim references by `spec.secretRef`; `delete_claim` removes
+ * it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ * never serialized with the request nor printed by `Debug`.
+ */secretFiles: [String: String]? = nil) {
self.pool = pool
self.spec = spec
self.name = name
self.labels = labels
+ self.secretFiles = secretFiles
}
@@ -3538,7 +3579,8 @@ public struct FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer {
pool: FfiConverterTypePool.read(from: &buf),
spec: FfiConverterOptionTypeClaimSpec.read(from: &buf),
name: FfiConverterOptionString.read(from: &buf),
- labels: FfiConverterOptionDictionaryStringString.read(from: &buf)
+ labels: FfiConverterOptionDictionaryStringString.read(from: &buf),
+ secretFiles: FfiConverterOptionDictionaryStringString.read(from: &buf)
)
}
@@ -3547,6 +3589,7 @@ public struct FfiConverterTypeCreateClaimRequest: FfiConverterRustBuffer {
FfiConverterOptionTypeClaimSpec.write(value.spec, into: &buf)
FfiConverterOptionString.write(value.name, into: &buf)
FfiConverterOptionDictionaryStringString.write(value.labels, into: &buf)
+ FfiConverterOptionDictionaryStringString.write(value.secretFiles, into: &buf)
}
}
@@ -6355,6 +6398,16 @@ private func uniffiForeignFutureDroppedCallback(handle: UInt64) {
public func uniffiForeignFutureHandleCountFleetSdk() -> Int {
UNIFFI_FOREIGN_FUTURE_HANDLE_MAP.count
}
+/**
+ * The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+ * that carries the cua-env-driver token for a claimed sandbox.
+ */
+public func claimEnvTokenKey() -> String {
+ return try! FfiConverterString.lift(try! rustCall() {
+ uniffi_cyclops_sdk_fn_func_claim_env_token_key($0
+ )
+})
+}
/**
* The label key a fleet's claims share, for callers that filter or clean up
* with raw Kubernetes tooling instead of `list_fleet_claims`.
@@ -6412,6 +6465,9 @@ private let initializationResult: InitializationResult = {
if bindings_contract_version != scaffolding_contract_version {
return InitializationResult.contractVersionMismatch
}
+ if (uniffi_cyclops_sdk_checksum_func_claim_env_token_key() != 8887) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_func_fleet_label_key() != 5219) {
return InitializationResult.apiChecksumMismatch
}
@@ -6433,7 +6489,7 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_claim() != 23330) {
return InitializationResult.apiChecksumMismatch
}
- if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 20460) {
+ if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() != 52233) {
return InitializationResult.apiChecksumMismatch
}
if (uniffi_cyclops_sdk_checksum_method_cyclopsclient_get_claim() != 17760) {
@@ -6565,6 +6621,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool() != 7405) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files() != 54115) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() != 28263) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
index 176317e568..5bdeda7e62 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkFFI.h
@@ -589,6 +589,11 @@ uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_name(uint64_t pt
uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
uint64_t uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
@@ -884,6 +889,12 @@ uint64_t uniffi_cyclops_sdk_fn_method_templatebuilder_metadata(uint64_t ptr, Rus
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_TEMPLATEBUILDER_SPEC
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_METHOD_TEMPLATEBUILDER_SPEC
uint64_t uniffi_cyclops_sdk_fn_method_templatebuilder_spec(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_CLAIM_ENV_TOKEN_KEY
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_CLAIM_ENV_TOKEN_KEY
+RustBuffer uniffi_cyclops_sdk_fn_func_claim_env_token_key(RustCallStatus *_Nonnull out_status
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_FN_FUNC_FLEET_LABEL_KEY
@@ -1179,6 +1190,12 @@ void ffi_cyclops_sdk_rust_future_free_void(uint64_t handle
#ifndef UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
#define UNIFFI_FFIDEF_FFI_CYCLOPS_SDK_RUST_FUTURE_COMPLETE_VOID
void ffi_cyclops_sdk_rust_future_complete_void(uint64_t handle, RustCallStatus *_Nonnull out_status
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_CLAIM_ENV_TOKEN_KEY
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_CLAIM_ENV_TOKEN_KEY
+uint16_t uniffi_cyclops_sdk_checksum_func_claim_env_token_key(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_FUNC_FLEET_LABEL_KEY
@@ -1485,6 +1502,12 @@ uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_name(void
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_POOL
uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SECRET_FILES
+uint16_t uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_CHECKSUM_METHOD_CREATECLAIMREQUESTBUILDER_SPEC
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
index b5a3b0010e..ee001b41be 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
@@ -1235,6 +1235,8 @@ public protocol VmTemplateBuilderProtocol: AnyObject, Sendable {
func build() throws -> VmTemplate
+ func claimSecrets(value: Bool) -> VmTemplateBuilder
+
func command(value: [String]) -> VmTemplateBuilder
func containerDiskImage(value: String) -> VmTemplateBuilder
@@ -1334,6 +1336,15 @@ open func build()throws -> VmTemplate {
})
}
+open func claimSecrets(value: Bool) -> VmTemplateBuilder {
+ return try! FfiConverterTypeVmTemplateBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ self.uniffiCloneHandle(),
+ FfiConverterBool.lower(value),$0
+ )
+})
+}
+
open func command(value: [String]) -> VmTemplateBuilder {
return try! FfiConverterTypeVmTemplateBuilder_lift(try! rustCall() {
uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(
@@ -1731,21 +1742,77 @@ public func FfiConverterTypeClaimLifecycle_lower(_ value: ClaimLifecycle) -> Rus
}
+/**
+ * Reference to a claim-scoped Secret delivered into the bound sandbox. See
+ * [`CLAIM_SECRET_NAME_PREFIX`].
+ */
+public struct ClaimSecretRef: Equatable, Hashable {
+ public var name: String
+
+ // Default memberwise initializers are never public by default, so we
+ // declare one manually.
+ public init(name: String) {
+ self.name = name
+ }
+
+
+
+
+}
+
+#if compiler(>=6)
+extension ClaimSecretRef: Sendable {}
+#endif
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public struct FfiConverterTypeClaimSecretRef: FfiConverterRustBuffer {
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> ClaimSecretRef {
+ return
+ try ClaimSecretRef(
+ name: FfiConverterString.read(from: &buf)
+ )
+ }
+
+ public static func write(_ value: ClaimSecretRef, into buf: inout [UInt8]) {
+ FfiConverterString.write(value.name, into: &buf)
+ }
+}
+
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeClaimSecretRef_lift(_ buf: RustBuffer) throws -> ClaimSecretRef {
+ return try FfiConverterTypeClaimSecretRef.lift(buf)
+}
+
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+public func FfiConverterTypeClaimSecretRef_lower(_ value: ClaimSecretRef) -> RustBuffer {
+ return FfiConverterTypeClaimSecretRef.lower(value)
+}
+
+
public struct ClaimSpec: Equatable, Hashable {
public var sandboxTemplateRef: SandboxTemplateRef
public var warmpool: String?
public var bindDeadline: UInt32?
public var lifecycle: ClaimLifecycle?
public var ttlSecondsAfterCreated: UInt32?
+ public var secretRef: ClaimSecretRef?
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(sandboxTemplateRef: SandboxTemplateRef, warmpool: String?, bindDeadline: UInt32?, lifecycle: ClaimLifecycle?, ttlSecondsAfterCreated: UInt32? = nil) {
+ public init(sandboxTemplateRef: SandboxTemplateRef, warmpool: String?, bindDeadline: UInt32?, lifecycle: ClaimLifecycle?, ttlSecondsAfterCreated: UInt32? = nil, secretRef: ClaimSecretRef? = nil) {
self.sandboxTemplateRef = sandboxTemplateRef
self.warmpool = warmpool
self.bindDeadline = bindDeadline
self.lifecycle = lifecycle
self.ttlSecondsAfterCreated = ttlSecondsAfterCreated
+ self.secretRef = secretRef
}
@@ -1768,7 +1835,8 @@ public struct FfiConverterTypeClaimSpec: FfiConverterRustBuffer {
warmpool: FfiConverterOptionString.read(from: &buf),
bindDeadline: FfiConverterOptionUInt32.read(from: &buf),
lifecycle: FfiConverterOptionTypeClaimLifecycle.read(from: &buf),
- ttlSecondsAfterCreated: FfiConverterOptionUInt32.read(from: &buf)
+ ttlSecondsAfterCreated: FfiConverterOptionUInt32.read(from: &buf),
+ secretRef: FfiConverterOptionTypeClaimSecretRef.read(from: &buf)
)
}
@@ -1778,6 +1846,7 @@ public struct FfiConverterTypeClaimSpec: FfiConverterRustBuffer {
FfiConverterOptionUInt32.write(value.bindDeadline, into: &buf)
FfiConverterOptionTypeClaimLifecycle.write(value.lifecycle, into: &buf)
FfiConverterOptionUInt32.write(value.ttlSecondsAfterCreated, into: &buf)
+ FfiConverterOptionTypeClaimSecretRef.write(value.secretRef, into: &buf)
}
}
@@ -2463,10 +2532,11 @@ public struct VmTemplate {
public var probes: PreservedJson?
public var services: [SandboxService]?
public var oidc: OidcConfig?
+ public var claimSecrets: Bool?
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(containerDiskImage: String, command: [String]?, runtime: RuntimeKind?, runtimeClassName: String?, nodeSelector: [String: String]?, tolerations: [PreservedJson]?, imagePullPolicy: ImagePullPolicy?, imagePullSecret: String?, cpuCores: UInt32?, memory: String?, firmware: Firmware?, nestedVirtualization: Bool?, probes: PreservedJson?, services: [SandboxService]?, oidc: OidcConfig?) {
+ public init(containerDiskImage: String, command: [String]?, runtime: RuntimeKind?, runtimeClassName: String?, nodeSelector: [String: String]?, tolerations: [PreservedJson]?, imagePullPolicy: ImagePullPolicy?, imagePullSecret: String?, cpuCores: UInt32?, memory: String?, firmware: Firmware?, nestedVirtualization: Bool?, probes: PreservedJson?, services: [SandboxService]?, oidc: OidcConfig?, claimSecrets: Bool? = nil) {
self.containerDiskImage = containerDiskImage
self.command = command
self.runtime = runtime
@@ -2482,6 +2552,7 @@ public struct VmTemplate {
self.probes = probes
self.services = services
self.oidc = oidc
+ self.claimSecrets = claimSecrets
}
@@ -2514,7 +2585,8 @@ public struct FfiConverterTypeVmTemplate: FfiConverterRustBuffer {
nestedVirtualization: FfiConverterOptionBool.read(from: &buf),
probes: FfiConverterOptionTypePreservedJson.read(from: &buf),
services: FfiConverterOptionSequenceTypeSandboxService.read(from: &buf),
- oidc: FfiConverterOptionTypeOidcConfig.read(from: &buf)
+ oidc: FfiConverterOptionTypeOidcConfig.read(from: &buf),
+ claimSecrets: FfiConverterOptionBool.read(from: &buf)
)
}
@@ -2534,6 +2606,7 @@ public struct FfiConverterTypeVmTemplate: FfiConverterRustBuffer {
FfiConverterOptionTypePreservedJson.write(value.probes, into: &buf)
FfiConverterOptionSequenceTypeSandboxService.write(value.services, into: &buf)
FfiConverterOptionTypeOidcConfig.write(value.oidc, into: &buf)
+ FfiConverterOptionBool.write(value.claimSecrets, into: &buf)
}
}
@@ -3162,6 +3235,30 @@ fileprivate struct FfiConverterOptionTypeClaimLifecycle: FfiConverterRustBuffer
}
}
+#if swift(>=5.8)
+@_documentation(visibility: private)
+#endif
+fileprivate struct FfiConverterOptionTypeClaimSecretRef: FfiConverterRustBuffer {
+ typealias SwiftType = ClaimSecretRef?
+
+ public static func write(_ value: SwiftType, into buf: inout [UInt8]) {
+ guard let value = value else {
+ writeInt(&buf, Int8(0))
+ return
+ }
+ writeInt(&buf, Int8(1))
+ FfiConverterTypeClaimSecretRef.write(value, into: &buf)
+ }
+
+ public static func read(from buf: inout (data: Data, offset: Data.Index)) throws -> SwiftType {
+ switch try readInt(&buf) as Int8 {
+ case 0: return nil
+ case 1: return try FfiConverterTypeClaimSecretRef.read(from: &buf)
+ default: throw UniffiInternalError.unexpectedOptionalTag
+ }
+ }
+}
+
#if swift(>=5.8)
@_documentation(visibility: private)
#endif
@@ -3612,6 +3709,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build() != 17867) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets() != 62567) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command() != 20371) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
index ad3244eadd..bd330474f6 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
@@ -326,6 +326,11 @@ uint64_t uniffi_cyclops_sdk_schema_fn_constructor_vmtemplatebuilder_new(RustCall
RustBuffer uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build(uint64_t ptr, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+uint64_t uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(uint64_t ptr, int8_t value, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_COMMAND
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_VMTEMPLATEBUILDER_COMMAND
uint64_t uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
@@ -824,6 +829,12 @@ uint16_t uniffi_cyclops_sdk_schema_checksum_method_sandboxtemplaterefbuilder_nam
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_BUILD
uint16_t uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_CLAIM_SECRETS
+uint16_t uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_VMTEMPLATEBUILDER_COMMAND
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/cyclops_sdk_schema_module.rs b/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/cyclops_sdk_schema_module.rs
index 08a114c8c4..76e5ee6337 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/cyclops_sdk_schema_module.rs
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/cyclops_sdk_schema_module.rs
@@ -67,6 +67,11 @@ extern "C" {
ptr: u64,
status_: &mut u::RustCallStatus,
) -> u::RustBuffer;
+ fn uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ ptr: u64,
+ value: i8,
+ status_: &mut u::RustCallStatus,
+ ) -> u64;
fn uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(
ptr: u64,
value: u::RustBuffer,
@@ -250,6 +255,7 @@ extern "C" {
fn uniffi_cyclops_sdk_schema_checksum_method_sandboxtemplaterefbuilder_build() -> u16;
fn uniffi_cyclops_sdk_schema_checksum_method_sandboxtemplaterefbuilder_name() -> u16;
fn uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build() -> u16;
+ fn uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets() -> u16;
fn uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command() -> u16;
fn uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_container_disk_image() -> u16;
fn uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_cpu_cores() -> u16;
@@ -516,6 +522,23 @@ pub fn ubrn_uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build(
value_.into_js()
}
#[wasm_bindgen]
+pub fn ubrn_uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ ptr: js::Handle,
+ value: js::Int8,
+ f_status_: &mut js::RustCallStatus,
+) -> js::Handle {
+ let mut u_status_ = u::RustCallStatus::default();
+ let value_ = unsafe {
+ uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ u64::into_rust(ptr),
+ i8::into_rust(value),
+ &mut u_status_,
+ )
+ };
+ f_status_.copy_from(u_status_);
+ value_.into_js()
+}
+#[wasm_bindgen]
pub fn ubrn_uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(
ptr: js::Handle,
value: js::ForeignBytes,
@@ -1156,6 +1179,11 @@ pub unsafe fn ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_b
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build().into_js()
}
#[wasm_bindgen]
+pub unsafe fn ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets(
+) -> js::UInt16 {
+ uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets().into_js()
+}
+#[wasm_bindgen]
pub unsafe fn ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command(
) -> js::UInt16 {
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command().into_js()
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/fleet_sdk_module.rs b/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/fleet_sdk_module.rs
index 239d02d1b2..436c817307 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/fleet_sdk_module.rs
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/cpp/fleet_sdk_module.rs
@@ -240,6 +240,11 @@ extern "C" {
value: u::RustBuffer,
status_: &mut u::RustCallStatus,
) -> u64;
+ fn uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ ptr: u64,
+ value: u::RustBuffer,
+ status_: &mut u::RustCallStatus,
+ ) -> u64;
fn uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(
ptr: u64,
value: u::RustBuffer,
@@ -484,6 +489,9 @@ extern "C" {
value: u::RustBuffer,
status_: &mut u::RustCallStatus,
) -> u64;
+ fn uniffi_cyclops_sdk_fn_func_claim_env_token_key(
+ status_: &mut u::RustCallStatus,
+ ) -> u::RustBuffer;
fn uniffi_cyclops_sdk_fn_func_fleet_label_key(status_: &mut u::RustCallStatus)
-> u::RustBuffer;
fn uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(
@@ -625,6 +633,7 @@ extern "C" {
fn ffi_cyclops_sdk_rust_future_cancel_void(handle: u64);
fn ffi_cyclops_sdk_rust_future_free_void(handle: u64);
fn ffi_cyclops_sdk_rust_future_complete_void(handle: u64, status_: &mut u::RustCallStatus);
+ fn uniffi_cyclops_sdk_checksum_func_claim_env_token_key() -> u16;
fn uniffi_cyclops_sdk_checksum_func_fleet_label_key() -> u16;
fn uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status() -> u16;
fn uniffi_cyclops_sdk_checksum_func_pool_display_status() -> u16;
@@ -676,6 +685,7 @@ extern "C" {
fn uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_labels() -> u16;
fn uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_name() -> u16;
fn uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool() -> u16;
+ fn uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files() -> u16;
fn uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() -> u16;
fn uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_build() -> u16;
fn uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_namespace() -> u16;
@@ -1502,6 +1512,23 @@ pub fn ubrn_uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool(
value_.into_js()
}
#[wasm_bindgen]
+pub fn ubrn_uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ ptr: js::Handle,
+ value: js::ForeignBytes,
+ f_status_: &mut js::RustCallStatus,
+) -> js::Handle {
+ let mut u_status_ = u::RustCallStatus::default();
+ let value_ = unsafe {
+ uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ u64::into_rust(ptr),
+ u::RustBuffer::into_rust(value),
+ &mut u_status_,
+ )
+ };
+ f_status_.copy_from(u_status_);
+ value_.into_js()
+}
+#[wasm_bindgen]
pub fn ubrn_uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(
ptr: js::Handle,
value: js::ForeignBytes,
@@ -2358,6 +2385,15 @@ pub fn ubrn_uniffi_cyclops_sdk_fn_method_templatebuilder_spec(
value_.into_js()
}
#[wasm_bindgen]
+pub fn ubrn_uniffi_cyclops_sdk_fn_func_claim_env_token_key(
+ f_status_: &mut js::RustCallStatus,
+) -> js::ForeignBytes {
+ let mut u_status_ = u::RustCallStatus::default();
+ let value_ = unsafe { uniffi_cyclops_sdk_fn_func_claim_env_token_key(&mut u_status_) };
+ f_status_.copy_from(u_status_);
+ value_.into_js()
+}
+#[wasm_bindgen]
pub fn ubrn_uniffi_cyclops_sdk_fn_func_fleet_label_key(
f_status_: &mut js::RustCallStatus,
) -> js::ForeignBytes {
@@ -2790,6 +2826,10 @@ pub fn ubrn_ffi_cyclops_sdk_rust_future_complete_void(
f_status_.copy_from(u_status_);
}
#[wasm_bindgen]
+pub unsafe fn ubrn_uniffi_cyclops_sdk_checksum_func_claim_env_token_key() -> js::UInt16 {
+ uniffi_cyclops_sdk_checksum_func_claim_env_token_key().into_js()
+}
+#[wasm_bindgen]
pub unsafe fn ubrn_uniffi_cyclops_sdk_checksum_func_fleet_label_key() -> js::UInt16 {
uniffi_cyclops_sdk_checksum_func_fleet_label_key().into_js()
}
@@ -3019,6 +3059,11 @@ pub unsafe fn ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool().into_js()
}
#[wasm_bindgen]
+pub unsafe fn ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files(
+) -> js::UInt16 {
+ uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files().into_js()
+}
+#[wasm_bindgen]
pub unsafe fn ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() -> js::UInt16
{
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec().into_js()
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
index 6e84238d07..d7f1996c2d 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
@@ -96,6 +96,49 @@ const FfiConverterTypeClaimLifecycle = (() => {
return new FFIConverter();
})();
+/**
+ * Reference to a claim-scoped Secret delivered into the bound sandbox. See
+ * [`CLAIM_SECRET_NAME_PREFIX`].
+ */
+export type ClaimSecretRef = {
+ name: string
+}
+
+/**
+ * Generated factory for {@link ClaimSecretRef} record objects.
+ */
+export const ClaimSecretRef = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<ClaimSecretRef, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<ClaimSecretRef>,
+ });
+})();
+
+const FfiConverterTypeClaimSecretRef = (() => {
+ type TypeName = ClaimSecretRef;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ name: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.name, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.name);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type SandboxTemplateRef = {
name: string
}
@@ -140,7 +183,8 @@ export type ClaimSpec = {
warmpool?: string,
bindDeadline?: number,
lifecycle?: ClaimLifecycle,
- ttlSecondsAfterCreated?: number
+ ttlSecondsAfterCreated?: number,
+ secretRef?: ClaimSecretRef
}
/**
@@ -148,7 +192,8 @@ export type ClaimSpec = {
*/
export const ClaimSpec = (() => {
const defaults = () => ({
- ttlSecondsAfterCreated: undefined
+ ttlSecondsAfterCreated: undefined,
+ secretRef: undefined
});
const create = (() => {
return uniffiCreateRecord<ClaimSpec, ReturnType<typeof defaults>>(defaults);
@@ -169,7 +214,8 @@ const FfiConverterTypeClaimSpec = (() => {
warmpool: FfiConverterOptionalString.read(from),
bindDeadline: FfiConverterOptionalUInt32.read(from),
lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from),
- ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from),
+ secretRef: FfiConverterOptionalTypeClaimSecretRef.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -178,13 +224,15 @@ const FfiConverterTypeClaimSpec = (() => {
FfiConverterOptionalUInt32.write(value.bindDeadline, into);
FfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, into);
FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
+ FfiConverterOptionalTypeClaimSecretRef.write(value.secretRef, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeSandboxTemplateRef.allocationSize(value.sandboxTemplateRef) +
FfiConverterOptionalString.allocationSize(value.warmpool) +
FfiConverterOptionalUInt32.allocationSize(value.bindDeadline) +
FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle) +
- FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated);
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated) +
+ FfiConverterOptionalTypeClaimSecretRef.allocationSize(value.secretRef);
}
};
@@ -709,7 +757,8 @@ export type VmTemplate = {
nestedVirtualization?: boolean,
probes?: PreservedJsonLike,
services?: Array<SandboxService>,
- oidc?: OidcConfig
+ oidc?: OidcConfig,
+ claimSecrets?: boolean
}
/**
@@ -717,6 +766,7 @@ export type VmTemplate = {
*/
export const VmTemplate = (() => {
const defaults = () => ({
+ claimSecrets: undefined
});
const create = (() => {
return uniffiCreateRecord<VmTemplate, ReturnType<typeof defaults>>(defaults);
@@ -747,7 +797,8 @@ const FfiConverterTypeVmTemplate = (() => {
nestedVirtualization: FfiConverterOptionalBoolean.read(from),
probes: FfiConverterOptionalTypePreservedJson.read(from),
services: FfiConverterOptionalSequenceTypeSandboxService.read(from),
- oidc: FfiConverterOptionalTypeOidcConfig.read(from)
+ oidc: FfiConverterOptionalTypeOidcConfig.read(from),
+ claimSecrets: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -766,6 +817,7 @@ const FfiConverterTypeVmTemplate = (() => {
FfiConverterOptionalTypePreservedJson.write(value.probes, into);
FfiConverterOptionalSequenceTypeSandboxService.write(value.services, into);
FfiConverterOptionalTypeOidcConfig.write(value.oidc, into);
+ FfiConverterOptionalBoolean.write(value.claimSecrets, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.containerDiskImage) +
@@ -782,7 +834,8 @@ const FfiConverterTypeVmTemplate = (() => {
FfiConverterOptionalBoolean.allocationSize(value.nestedVirtualization) +
FfiConverterOptionalTypePreservedJson.allocationSize(value.probes) +
FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.services) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc);
+ FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc) +
+ FfiConverterOptionalBoolean.allocationSize(value.claimSecrets);
}
};
@@ -1920,6 +1973,7 @@ const FfiConverterTypeSandboxTemplateRefBuilder = new FfiConverterObject(uniffiT
export interface VmTemplateBuilderLike {
build() /*throws*/: VmTemplate;
+ claimSecrets(value: boolean): VmTemplateBuilderLike;
command(value: Array<string>): VmTemplateBuilderLike;
containerDiskImage(value: string): VmTemplateBuilderLike;
cpuCores(value: number): VmTemplateBuilderLike;
@@ -1982,6 +2036,18 @@ export class VmTemplateBuilder extends UniffiAbstractObject implements VmTemplat
));
}
+ claimSecrets(value: boolean): VmTemplateBuilderLike {
+ return FfiConverterTypeVmTemplateBuilder.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(
+ uniffiTypeVmTemplateBuilderObjectFactory.clonePointer(this),
+ FfiConverterBool.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
command(value: Array<string>): VmTemplateBuilderLike {
return FfiConverterTypeVmTemplateBuilder.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
@@ -2423,6 +2489,9 @@ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
// FfiConverter for ClaimLifecycle | undefined
const FfiConverterOptionalTypeClaimLifecycle = new FfiConverterOptional(FfiConverterTypeClaimLifecycle);
+// FfiConverter for ClaimSecretRef | undefined
+const FfiConverterOptionalTypeClaimSecretRef = new FfiConverterOptional(FfiConverterTypeClaimSecretRef);
+
// FfiConverter for Array<OsGymSandboxClaimCondition>
const FfiConverterSequenceTypeOSGymSandboxClaimCondition = new FfiConverterArray(FfiConverterTypeOSGymSandboxClaimCondition);
@@ -2559,6 +2628,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build() !== 17867) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build");
}
+ if (nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets() !== 62567) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets");
+ }
if (nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command() !== 20371) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command");
}
@@ -2626,6 +2698,7 @@ export default Object.freeze({
initialize: uniffiEnsureInitialized,
converters: {
FfiConverterTypeClaimLifecycle,
+ FfiConverterTypeClaimSecretRef,
FfiConverterTypeClaimSpec,
FfiConverterTypeFirmware,
FfiConverterTypeImagePullPolicy,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
index 51addc9f3b..80b1b34983 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
@@ -32,6 +32,26 @@ const uniffiIsDebug =
// Public interface members begin here.
+/**
+ * The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+ * that carries the cua-env-driver token for a claimed sandbox.
+ */
+export function claimEnvTokenKey(): string {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterString.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_func_claim_env_token_key(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The label key a fleet's claims share, for callers that filter or clean up
* with raw Kubernetes tooling instead of `list_fleet_claims`.
@@ -338,7 +358,17 @@ export type CreateClaimRequest = {
* helpers (for example fleet fan-out) rely on this to tag related claims
* so they can be listed back by label within a namespace.
*/
- labels?: Map<string, string>
+ labels?: Map<string, string>,
+ /**
+ * Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ * 0600) once the claim binds, without restarting it. The key
+ * `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ * The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ * that the claim references by `spec.secretRef`; `delete_claim` removes
+ * it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ * never serialized with the request nor printed by `Debug`.
+ */
+ secretFiles?: Map<string, string>
}
/**
@@ -347,7 +377,8 @@ export type CreateClaimRequest = {
export const CreateClaimRequest = (() => {
const defaults = () => ({
name: undefined,
- labels: undefined
+ labels: undefined,
+ secretFiles: undefined
});
const create = (() => {
return uniffiCreateRecord<CreateClaimRequest, ReturnType<typeof defaults>>(defaults);
@@ -367,7 +398,8 @@ const FfiConverterTypeCreateClaimRequest = (() => {
pool: FfiConverterTypePool.read(from),
spec: FfiConverterOptionalTypeClaimSpec.read(from),
name: FfiConverterOptionalString.read(from),
- labels: FfiConverterOptionalMapStringString.read(from)
+ labels: FfiConverterOptionalMapStringString.read(from),
+ secretFiles: FfiConverterOptionalMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -375,12 +407,14 @@ const FfiConverterTypeCreateClaimRequest = (() => {
FfiConverterOptionalTypeClaimSpec.write(value.spec, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalMapStringString.write(value.labels, into);
+ FfiConverterOptionalMapStringString.write(value.secretFiles, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypePool.allocationSize(value.pool) +
FfiConverterOptionalTypeClaimSpec.allocationSize(value.spec) +
FfiConverterOptionalString.allocationSize(value.name) +
- FfiConverterOptionalMapStringString.allocationSize(value.labels);
+ FfiConverterOptionalMapStringString.allocationSize(value.labels) +
+ FfiConverterOptionalMapStringString.allocationSize(value.secretFiles);
}
};
@@ -2932,6 +2966,7 @@ export interface CreateClaimRequestBuilderLike {
labels(value: Map<string, string>): CreateClaimRequestBuilderLike;
name(value: string): CreateClaimRequestBuilderLike;
pool(value: Pool): CreateClaimRequestBuilderLike;
+ secretFiles(value: Map<string, string>): CreateClaimRequestBuilderLike;
spec(value: ClaimSpec): CreateClaimRequestBuilderLike;
}
/**
@@ -3016,6 +3051,18 @@ export class CreateClaimRequestBuilder extends UniffiAbstractObject implements C
));
}
+ secretFiles(value: Map<string, string>): CreateClaimRequestBuilderLike {
+ return FfiConverterTypeCreateClaimRequestBuilder.lift(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(
+ uniffiTypeCreateClaimRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterMapStringString.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
spec(value: ClaimSpec): CreateClaimRequestBuilderLike {
return FfiConverterTypeCreateClaimRequestBuilder.lift(uniffiCaller.rustCall(
/*caller:*/ (callStatus) => {
@@ -3797,6 +3844,11 @@ export interface CyclopsClientLike {
createSignedServiceUrl(request: CreateSignedServiceUrlRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SignedServiceUrl>;
createTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
createUserApiKey(request: CreateUserApiKeyRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<NewUserApiKey>;
+/**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteImage(namespace: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteNamespace(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
@@ -4198,6 +4250,11 @@ private constructor(pointer: UniffiHandle) {
);
}
+/**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
async deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
return await uniffiRustCallAsync(
/*rustCaller:*/ uniffiCaller,
@@ -5861,6 +5918,9 @@ function uniffiEnsureInitialized() {
if (bindingsContractVersion !== scaffoldingContractVersion) {
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
}
+ if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_func_claim_env_token_key() !== 8887) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_claim_env_token_key");
+ }
if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_func_fleet_label_key() !== 5219) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_fleet_label_key");
}
@@ -5897,6 +5957,9 @@ function uniffiEnsureInitialized() {
if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool() !== 7405) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool");
}
+ if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files() !== 54115) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files");
+ }
if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec() !== 28263) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec");
}
@@ -6005,7 +6068,7 @@ function uniffiEnsureInitialized() {
if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key() !== 9174) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key");
}
- if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !== 20460) {
+ if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !== 52233) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim");
}
if (nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_image() !== 24680) {
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
index a07a76a194..aeb6bd1eb3 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema-ffi.ts
@@ -438,6 +438,11 @@ const DEFINITIONS = {
ret: FfiType.RustBuffer,
hasRustCallStatus: true,
},
+ "uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets": {
+ args: [FfiType.Handle, FfiType.Int8],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -648,6 +653,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command": {
args: [],
ret: FfiType.UInt16,
@@ -853,6 +863,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_schema_fn_method_sandboxtemplaterefbuilder_name(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_constructor_vmtemplatebuilder_new(uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_build(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
+ uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_claim_secrets(uniffiSelf: bigint, value: number, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_command(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_container_disk_image(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_schema_fn_method_vmtemplatebuilder_cpu_cores(uniffiSelf: bigint, value: number, uniffi_out_err: UniffiRustCallStatus): bigint;
@@ -895,6 +906,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_schema_checksum_method_sandboxtemplaterefbuilder_name(): number;
uniffi_cyclops_sdk_schema_checksum_constructor_vmtemplatebuilder_new(): number;
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_build(): number;
+ uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_claim_secrets(): number;
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_command(): number;
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_container_disk_image(): number;
uniffi_cyclops_sdk_schema_checksum_method_vmtemplatebuilder_cpu_cores(): number;
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
index 5d3fda120a..dea5659839 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
@@ -87,6 +87,49 @@ const FfiConverterTypeClaimLifecycle = (() => {
return new FFIConverter();
})();
+/**
+ * Reference to a claim-scoped Secret delivered into the bound sandbox. See
+ * [`CLAIM_SECRET_NAME_PREFIX`].
+ */
+export type ClaimSecretRef = {
+ name: string
+}
+
+/**
+ * Generated factory for {@link ClaimSecretRef} record objects.
+ */
+export const ClaimSecretRef = (() => {
+ const defaults = () => ({
+ });
+ const create = (() => {
+ return uniffiCreateRecord<ClaimSecretRef, ReturnType<typeof defaults>>(defaults);
+ })();
+ return Object.freeze({
+ create,
+ new: create,
+ defaults: () => Object.freeze(defaults()) as Partial<ClaimSecretRef>,
+ });
+})();
+
+const FfiConverterTypeClaimSecretRef = (() => {
+ type TypeName = ClaimSecretRef;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ return {
+ name: FfiConverterString.read(from)
+ };
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ FfiConverterString.write(value.name, into);
+ }
+ allocationSize(value: TypeName): number {
+ return FfiConverterString.allocationSize(value.name);
+
+ }
+ };
+ return new FFIConverter();
+})();
+
export type SandboxTemplateRef = {
name: string
}
@@ -131,7 +174,8 @@ export type ClaimSpec = {
warmpool?: string,
bindDeadline?: number,
lifecycle?: ClaimLifecycle,
- ttlSecondsAfterCreated?: number
+ ttlSecondsAfterCreated?: number,
+ secretRef?: ClaimSecretRef
}
/**
@@ -139,7 +183,8 @@ export type ClaimSpec = {
*/
export const ClaimSpec = (() => {
const defaults = () => ({
- ttlSecondsAfterCreated: undefined
+ ttlSecondsAfterCreated: undefined,
+ secretRef: undefined
});
const create = (() => {
return uniffiCreateRecord<ClaimSpec, ReturnType<typeof defaults>>(defaults);
@@ -160,7 +205,8 @@ const FfiConverterTypeClaimSpec = (() => {
warmpool: FfiConverterOptionalString.read(from),
bindDeadline: FfiConverterOptionalUInt32.read(from),
lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from),
- ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from),
+ secretRef: FfiConverterOptionalTypeClaimSecretRef.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -169,13 +215,15 @@ const FfiConverterTypeClaimSpec = (() => {
FfiConverterOptionalUInt32.write(value.bindDeadline, into);
FfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, into);
FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
+ FfiConverterOptionalTypeClaimSecretRef.write(value.secretRef, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeSandboxTemplateRef.allocationSize(value.sandboxTemplateRef) +
FfiConverterOptionalString.allocationSize(value.warmpool) +
FfiConverterOptionalUInt32.allocationSize(value.bindDeadline) +
FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle) +
- FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated);
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated) +
+ FfiConverterOptionalTypeClaimSecretRef.allocationSize(value.secretRef);
}
};
@@ -700,7 +748,8 @@ export type VmTemplate = {
nestedVirtualization?: boolean,
probes?: PreservedJsonLike,
services?: Array<SandboxService>,
- oidc?: OidcConfig
+ oidc?: OidcConfig,
+ claimSecrets?: boolean
}
/**
@@ -708,6 +757,7 @@ export type VmTemplate = {
*/
export const VmTemplate = (() => {
const defaults = () => ({
+ claimSecrets: undefined
});
const create = (() => {
return uniffiCreateRecord<VmTemplate, ReturnType<typeof defaults>>(defaults);
@@ -738,7 +788,8 @@ const FfiConverterTypeVmTemplate = (() => {
nestedVirtualization: FfiConverterOptionalBoolean.read(from),
probes: FfiConverterOptionalTypePreservedJson.read(from),
services: FfiConverterOptionalSequenceTypeSandboxService.read(from),
- oidc: FfiConverterOptionalTypeOidcConfig.read(from)
+ oidc: FfiConverterOptionalTypeOidcConfig.read(from),
+ claimSecrets: FfiConverterOptionalBoolean.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -757,6 +808,7 @@ const FfiConverterTypeVmTemplate = (() => {
FfiConverterOptionalTypePreservedJson.write(value.probes, into);
FfiConverterOptionalSequenceTypeSandboxService.write(value.services, into);
FfiConverterOptionalTypeOidcConfig.write(value.oidc, into);
+ FfiConverterOptionalBoolean.write(value.claimSecrets, into);
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.containerDiskImage) +
@@ -773,7 +825,8 @@ const FfiConverterTypeVmTemplate = (() => {
FfiConverterOptionalBoolean.allocationSize(value.nestedVirtualization) +
FfiConverterOptionalTypePreservedJson.allocationSize(value.probes) +
FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.services) +
- FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc);
+ FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc) +
+ FfiConverterOptionalBoolean.allocationSize(value.claimSecrets);
}
};
@@ -1282,6 +1335,9 @@ const FfiConverterOptionalUInt32 = new FfiConverterOptional(FfiConverterUInt32);
// FfiConverter for ClaimLifecycle | undefined
const FfiConverterOptionalTypeClaimLifecycle = new FfiConverterOptional(FfiConverterTypeClaimLifecycle);
+// FfiConverter for ClaimSecretRef | undefined
+const FfiConverterOptionalTypeClaimSecretRef = new FfiConverterOptional(FfiConverterTypeClaimSecretRef);
+
// FfiConverter for Array<OsGymSandboxClaimCondition>
const FfiConverterSequenceTypeOSGymSandboxClaimCondition = new FfiConverterArray(FfiConverterTypeOSGymSandboxClaimCondition);
@@ -1368,6 +1424,7 @@ export default Object.freeze({
initialize: uniffiEnsureInitialized,
converters: {
FfiConverterTypeClaimLifecycle,
+ FfiConverterTypeClaimSecretRef,
FfiConverterTypeClaimSpec,
FfiConverterTypeFirmware,
FfiConverterTypeImagePullPolicy,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
index 0eb5f13b9a..b40a3d64a4 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk-ffi.ts
@@ -393,6 +393,11 @@ const DEFINITIONS = {
ret: FfiType.Void,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_fn_func_claim_env_token_key": {
+ args: [],
+ ret: FfiType.RustBuffer,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_fn_func_fleet_label_key": {
args: [],
ret: FfiType.RustBuffer,
@@ -453,6 +458,11 @@ const DEFINITIONS = {
ret: FfiType.Handle,
hasRustCallStatus: true,
},
+ "uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files": {
+ args: [FfiType.Handle, FfiType.RustBuffer],
+ ret: FfiType.Handle,
+ hasRustCallStatus: true,
+ },
"uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec": {
args: [FfiType.Handle, FfiType.RustBuffer],
ret: FfiType.Handle,
@@ -903,6 +913,11 @@ const DEFINITIONS = {
ret: FfiType.UInt32,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_func_claim_env_token_key": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_func_fleet_label_key": {
args: [],
ret: FfiType.UInt16,
@@ -963,6 +978,11 @@ const DEFINITIONS = {
ret: FfiType.UInt16,
hasRustCallStatus: false,
},
+ "uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files": {
+ args: [],
+ ret: FfiType.UInt16,
+ hasRustCallStatus: false,
+ },
"uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec": {
args: [],
ret: FfiType.UInt16,
@@ -1555,6 +1575,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_fn_free_templatebuilder(ptr: bigint, uniffi_out_err: UniffiRustCallStatus): void;
uniffi_cyclops_sdk_fn_init_callback_vtable_accesstokenprovider(vtable: UniffiVTableCallbackInterfaceFleetSdkAccessTokenProvider): void;
uniffi_cyclops_sdk_fn_init_callback_vtable_httpclient(vtable: UniffiVTableCallbackInterfaceFleetSdkHttpClient): void;
+ uniffi_cyclops_sdk_fn_func_claim_env_token_key(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cyclops_sdk_fn_func_fleet_label_key(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cyclops_sdk_fn_func_healthy_pool_display_status(uniffi_out_err: UniffiRustCallStatus): Uint8Array;
uniffi_cyclops_sdk_fn_func_pool_display_status(pool: Uint8Array, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -1567,6 +1588,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_labels(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_name(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_pool(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
+ uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_secret_files(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_createclaimrequestbuilder_spec(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_constructor_createpoolrequestbuilder_new(uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_createpoolrequestbuilder_build(uniffiSelf: bigint, uniffi_out_err: UniffiRustCallStatus): Uint8Array;
@@ -1657,6 +1679,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_fn_method_templatebuilder_metadata(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
uniffi_cyclops_sdk_fn_method_templatebuilder_spec(uniffiSelf: bigint, value: Uint8Array, uniffi_out_err: UniffiRustCallStatus): bigint;
ffi_cyclops_sdk_uniffi_contract_version(): number;
+ uniffi_cyclops_sdk_checksum_func_claim_env_token_key(): number;
uniffi_cyclops_sdk_checksum_func_fleet_label_key(): number;
uniffi_cyclops_sdk_checksum_func_healthy_pool_display_status(): number;
uniffi_cyclops_sdk_checksum_func_pool_display_status(): number;
@@ -1669,6 +1692,7 @@ interface NativeModuleInterface {
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_labels(): number;
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_name(): number;
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_pool(): number;
+ uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_secret_files(): number;
uniffi_cyclops_sdk_checksum_method_createclaimrequestbuilder_spec(): number;
uniffi_cyclops_sdk_checksum_constructor_createpoolrequestbuilder_new(): number;
uniffi_cyclops_sdk_checksum_method_createpoolrequestbuilder_build(): number;
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
index 36b190df65..f188cb9344 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/fleet_sdk.ts
@@ -23,6 +23,26 @@ const uniffiIsDebug =
// Public interface members begin here.
+/**
+ * The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+ * that carries the cua-env-driver token for a claimed sandbox.
+ */
+export function claimEnvTokenKey(): string {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterString.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().uniffi_cyclops_sdk_fn_func_claim_env_token_key(
+ callStatus);
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ));
+ }
+
/**
* The label key a fleet's claims share, for callers that filter or clean up
* with raw Kubernetes tooling instead of `list_fleet_claims`.
@@ -329,7 +349,17 @@ export type CreateClaimRequest = {
* helpers (for example fleet fan-out) rely on this to tag related claims
* so they can be listed back by label within a namespace.
*/
- labels?: Map<string, string>
+ labels?: Map<string, string>,
+ /**
+ * Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ * 0600) once the claim binds, without restarting it. The key
+ * `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ * The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ * that the claim references by `spec.secretRef`; `delete_claim` removes
+ * it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ * never serialized with the request nor printed by `Debug`.
+ */
+ secretFiles?: Map<string, string>
}
/**
@@ -338,7 +368,8 @@ export type CreateClaimRequest = {
export const CreateClaimRequest = (() => {
const defaults = () => ({
name: undefined,
- labels: undefined
+ labels: undefined,
+ secretFiles: undefined
});
const create = (() => {
return uniffiCreateRecord<CreateClaimRequest, ReturnType<typeof defaults>>(defaults);
@@ -358,7 +389,8 @@ const FfiConverterTypeCreateClaimRequest = (() => {
pool: FfiConverterTypePool.read(from),
spec: FfiConverterOptionalTypeClaimSpec.read(from),
name: FfiConverterOptionalString.read(from),
- labels: FfiConverterOptionalMapStringString.read(from)
+ labels: FfiConverterOptionalMapStringString.read(from),
+ secretFiles: FfiConverterOptionalMapStringString.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -366,12 +398,14 @@ const FfiConverterTypeCreateClaimRequest = (() => {
FfiConverterOptionalTypeClaimSpec.write(value.spec, into);
FfiConverterOptionalString.write(value.name, into);
FfiConverterOptionalMapStringString.write(value.labels, into);
+ FfiConverterOptionalMapStringString.write(value.secretFiles, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypePool.allocationSize(value.pool) +
FfiConverterOptionalTypeClaimSpec.allocationSize(value.spec) +
FfiConverterOptionalString.allocationSize(value.name) +
- FfiConverterOptionalMapStringString.allocationSize(value.labels);
+ FfiConverterOptionalMapStringString.allocationSize(value.labels) +
+ FfiConverterOptionalMapStringString.allocationSize(value.secretFiles);
}
};
@@ -2951,6 +2985,11 @@ export interface CyclopsClientLike {
createSignedServiceUrl(request: CreateSignedServiceUrlRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<SignedServiceUrl>;
createTemplate(request: CreateTemplateRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<Template>;
createUserApiKey(request: CreateUserApiKeyRequest, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<NewUserApiKey>;
+/**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteImage(namespace: string, name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
deleteNamespace(name: string, asyncOpts_?: { signal: AbortSignal }) /*throws*/: Promise<void>;
@@ -3424,6 +3463,11 @@ private constructor(pointer: UniffiHandle) {
}
}
+/**
+ * Delete the claim and, when it references a claim-scoped Secret
+ * (`secret_files`), that Secret too. The pool-operator also owner-refs
+ * the Secret to the claim, so garbage collection is the backstop.
+ */
async deleteClaim(claim: Claim, asyncOpts_?: { signal: AbortSignal }): Promise<void> /*throws*/ {
const __stack = uniffiIsDebug ? new Error().stack : undefined;
try {
@@ -4749,6 +4793,9 @@ function uniffiEnsureInitialized() {
if (bindingsContractVersion !== scaffoldingContractVersion) {
throw new UniffiInternalError.ContractVersionMismatch(scaffoldingContractVersion, bindingsContractVersion);
}
+ if (nativeModule().uniffi_cyclops_sdk_checksum_func_claim_env_token_key() !== 8887) {
+ throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_claim_env_token_key");
+ }
if (nativeModule().uniffi_cyclops_sdk_checksum_func_fleet_label_key() !== 5219) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_func_fleet_label_key");
}
@@ -4818,7 +4865,7 @@ function uniffiEnsureInitialized() {
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key() !== 9174) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_create_user_api_key");
}
- if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !== 20460) {
+ if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim() !== 52233) {
throw new UniffiInternalError.ApiChecksumMismatch("uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_claim");
}
if (nativeModule().uniffi_cyclops_sdk_checksum_method_cyclopsclient_delete_image() !== 24680) {
diff --git a/libs/fleet/sdk-schema/src/claim.rs b/libs/fleet/sdk-schema/src/claim.rs
index 74aaa4a9a6..14f937d29a 100644
--- a/libs/fleet/sdk-schema/src/claim.rs
+++ b/libs/fleet/sdk-schema/src/claim.rs
@@ -8,6 +8,16 @@ use serde::{Deserialize, Serialize};
pub const DEFAULT_CLAIM_BIND_DEADLINE_SECONDS: u32 = 900;
+/// Name prefix every claim-referenced Secret must carry. The /api/k8s gateway
+/// only lets a tenant create or delete Secrets with this prefix, and the
+/// pool-operator refuses to deliver any other Secret into a sandbox.
+pub const CLAIM_SECRET_NAME_PREFIX: &str = "cua-claim-";
+
+/// Secret key (and in-guest file name) carrying the in-guest daemon token.
+/// The pool-operator delivers it to `/run/cua/env-token`, the path
+/// cua-env-driver reads its token from.
+pub const CLAIM_ENV_TOKEN_KEY: &str = "env-token";
+
fn default_warmpool() -> Option<String> {
Some("default".into())
}
@@ -33,6 +43,22 @@ fn sandbox_template_ref_schema(_: &mut schemars::SchemaGenerator) -> schemars::S
})
}
+fn claim_secret_ref_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
+ schemars::json_schema!({
+ "type": "object",
+ "required": ["name"],
+ "description": "Secret in the claim's namespace whose keys the pool-operator\ndelivers as files into the bound sandbox once it binds, without\nrestarting it: each key becomes /run/cua/<key> (mode 0600), e.g.\nenv-token -> /run/cua/env-token for cua-env-driver. The data is\ncopied into an operator-owned per-sandbox Secret, never into the\nclaim status, and is wiped when the claim is released. The name\nmust be cua-claim-<claim name>, and the claim's template must set\nvmTemplate.claimSecrets, or the claim fails.\n",
+ "properties": {
+ "name": {
+ "type": "string",
+ "maxLength": 253,
+ "pattern": "^cua-claim-[a-z0-9]([-a-z0-9]*[a-z0-9])?$",
+ "description": "Secret name (must start with cua-claim-)."
+ }
+ }
+ })
+}
+
fn claim_lifecycle_schema(generator: &mut schemars::SchemaGenerator) -> schemars::Schema {
ClaimLifecycle::json_schema(generator)
}
@@ -71,6 +97,14 @@ pub struct ClaimLifecycle {
pub auto_renew: Option<bool>,
}
+/// Reference to a claim-scoped Secret delivered into the bound sandbox. See
+/// [`CLAIM_SECRET_NAME_PREFIX`].
+#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, JsonSchema, uniffi::Record)]
+#[serde(rename_all = "camelCase")]
+pub struct ClaimSecretRef {
+ pub name: String,
+}
+
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, JsonSchema, uniffi::Record)]
#[serde(rename_all = "camelCase")]
pub struct OSGymSandboxClaimCondition {
@@ -192,4 +226,8 @@ pub struct ClaimSpec {
#[serde(skip_serializing_if = "Option::is_none")]
#[uniffi(default = None)]
pub ttl_seconds_after_created: Option<u32>,
+ #[schemars(default, schema_with = "claim_secret_ref_schema")]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[uniffi(default = None)]
+ pub secret_ref: Option<ClaimSecretRef>,
}
diff --git a/libs/fleet/sdk-schema/src/common.rs b/libs/fleet/sdk-schema/src/common.rs
index e792e5f931..0cec209a18 100644
--- a/libs/fleet/sdk-schema/src/common.rs
+++ b/libs/fleet/sdk-schema/src/common.rs
@@ -280,6 +280,14 @@ pub struct VmTemplate {
#[serde(skip_serializing_if = "Option::is_none")]
#[schemars(default)]
pub oidc: Option<OidcConfig>,
+ #[schemars(
+ description = "Opt in to claim-scoped secret delivery (OSGymSandboxClaim spec.secretRef). The pool-operator gives every sandbox an operator-owned Secret, empty while the sandbox is warm, fills it when a claim binds and wipes it on release, so a warm sandbox receives its claimant's secrets without a restart. Pod runtimes mount it read-only as a directory (never subPath) at /run/cua, root-owned, mode 0600; the image keeps its default root user, and its root token-sync helper hands the token to a non-root driver. KubeVirt shares it over virtiofs as tag cua-claim-secrets (needs the KubeVirt EnableVirtioFsConfigVolumes feature gate); the guest image mounts that tag read-only at /run/cua. cua-env-driver images enable their await-token mode only when /run/cua is a mount point, so the key env-token becomes /run/cua/env-token. Claims with a secretRef fail on templates without this flag.",
+ schema_with = "bool_schema"
+ )]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[schemars(default)]
+ #[uniffi(default = None)]
+ pub claim_secrets: Option<bool>,
}
pub(crate) fn date_time_schema(_: &mut schemars::SchemaGenerator) -> schemars::Schema {
diff --git a/libs/fleet/sdk-schema/src/lib.rs b/libs/fleet/sdk-schema/src/lib.rs
index 0183356451..1d05470e89 100644
--- a/libs/fleet/sdk-schema/src/lib.rs
+++ b/libs/fleet/sdk-schema/src/lib.rs
@@ -6,8 +6,9 @@ mod sandbox;
mod warmpool;
pub use claim::{
- ClaimLifecycle, ClaimSpec, DEFAULT_CLAIM_BIND_DEADLINE_SECONDS, OSGymSandboxClaim,
- OSGymSandboxClaimCondition, OSGymSandboxClaimSandbox, OSGymSandboxClaimStatus,
+ CLAIM_ENV_TOKEN_KEY, CLAIM_SECRET_NAME_PREFIX, ClaimLifecycle, ClaimSecretRef, ClaimSpec,
+ DEFAULT_CLAIM_BIND_DEADLINE_SECONDS, OSGymSandboxClaim, OSGymSandboxClaimCondition,
+ OSGymSandboxClaimSandbox, OSGymSandboxClaimStatus,
};
pub use common::{
Firmware, ImagePullPolicy, OidcConfig, RuntimeKind, SandboxService, SandboxServiceBuilder,
diff --git a/libs/fleet/sdk-schema/tests/claim_crds.rs b/libs/fleet/sdk-schema/tests/claim_crds.rs
index 0b1d22d0f5..bedac1178b 100644
--- a/libs/fleet/sdk-schema/tests/claim_crds.rs
+++ b/libs/fleet/sdk-schema/tests/claim_crds.rs
@@ -166,3 +166,60 @@ fn claim_raw_crd_matches_the_authoritative_field_contract() {
assert_eq!(generated, authoritative);
}
+
+#[test]
+fn claim_secret_ref_is_optional_and_pinned_to_the_gateway_prefix() {
+ let claim = serde_json::to_value(OSGymSandboxClaim::crd()).unwrap();
+ let spec = claim
+ .pointer("/spec/versions/0/schema/openAPIV3Schema/properties/spec")
+ .unwrap();
+ let required = spec.get("required").and_then(Value::as_array).unwrap();
+ assert!(!required.contains(&json!("secretRef")));
+
+ let name = spec
+ .pointer("/properties/secretRef/properties/name")
+ .unwrap();
+ let pattern = name["pattern"].as_str().unwrap();
+ assert!(pattern.starts_with(&format!(
+ "^{}",
+ cyclops_sdk_schema::CLAIM_SECRET_NAME_PREFIX
+ )));
+ assert_eq!(name["maxLength"], json!(253));
+ assert_eq!(
+ spec.pointer("/properties/secretRef/required"),
+ Some(&json!(["name"]))
+ );
+}
+
+#[test]
+fn claim_spec_round_trips_secret_ref_and_omits_it_when_unset() {
+ use cyclops_sdk_schema::{ClaimSecretRef, ClaimSpec};
+
+ let spec: ClaimSpec = serde_json::from_value(json!({
+ "sandboxTemplateRef": { "name": "pool-template" },
+ "secretRef": { "name": "cua-claim-claim-a" },
+ }))
+ .unwrap();
+ assert_eq!(
+ spec.secret_ref,
+ Some(ClaimSecretRef {
+ name: "cua-claim-claim-a".into()
+ })
+ );
+ assert_eq!(
+ serde_json::to_value(&spec).unwrap()["secretRef"],
+ json!({ "name": "cua-claim-claim-a" })
+ );
+
+ let bare: ClaimSpec = serde_json::from_value(json!({
+ "sandboxTemplateRef": { "name": "pool-template" },
+ }))
+ .unwrap();
+ assert!(bare.secret_ref.is_none());
+ assert!(
+ serde_json::to_value(&bare)
+ .unwrap()
+ .get("secretRef")
+ .is_none()
+ );
+}
diff --git a/libs/fleet/sdk-schema/tests/ffi_models.rs b/libs/fleet/sdk-schema/tests/ffi_models.rs
index fca069e9cb..219db6b049 100644
--- a/libs/fleet/sdk-schema/tests/ffi_models.rs
+++ b/libs/fleet/sdk-schema/tests/ffi_models.rs
@@ -104,6 +104,7 @@ fn vm_template_round_trips_every_known_field() {
aws_role_arn: Some("arn:aws:iam::123456789012:role/workload".into()),
refresh_interval_seconds: Some(900),
}),
+ claim_secrets: Some(true),
};
let value = serde_json::to_value(&template).unwrap();
@@ -148,6 +149,7 @@ fn minimal_vm_template_omits_none_fields_and_round_trips() {
probes: None,
services: None,
oidc: None,
+ claim_secrets: None,
};
let value = serde_json::to_value(&template).unwrap();
diff --git a/libs/fleet/sdk/src/claims.rs b/libs/fleet/sdk/src/claims.rs
index 15c66865a7..912ad866a4 100644
--- a/libs/fleet/sdk/src/claims.rs
+++ b/libs/fleet/sdk/src/claims.rs
@@ -2,18 +2,32 @@ use crate::{
Claim, CreateClaimRequest, CyclopsClient, HttpHeader, HttpRequest, HttpResponse, Pool,
ResourceMetadata, Sandbox, SdkError, Template, routes,
};
-use cyclops_sdk_schema::{ClaimSpec, DEFAULT_CLAIM_BIND_DEADLINE_SECONDS};
+use cyclops_sdk_schema::{
+ CLAIM_ENV_TOKEN_KEY, CLAIM_SECRET_NAME_PREFIX, ClaimSecretRef, ClaimSpec,
+ DEFAULT_CLAIM_BIND_DEADLINE_SECONDS,
+};
#[cfg(not(target_arch = "wasm32"))]
use futures_timer::Delay;
#[cfg(target_arch = "wasm32")]
use gloo_timers::future::TimeoutFuture;
use serde::{Deserialize, Serialize, de::DeserializeOwned};
-use std::sync::Arc;
#[cfg(not(target_arch = "wasm32"))]
use std::time::Duration;
+use std::{collections::HashMap, sync::Arc};
use url::Url;
const JSON_CONTENT_TYPE: &str = "application/json";
+/// Label stamped on a claim-scoped Secret naming the claim it belongs to.
+const CLAIM_SECRET_CLAIM_LABEL: &str = "osgym.cua.ai/claim";
+/// Longest Secret data key Kubernetes accepts.
+const MAX_SECRET_KEY_BYTES: usize = 253;
+
+/// The `secret_files` key (and in-guest file name, `/run/cua/env-token`)
+/// that carries the cua-env-driver token for a claimed sandbox.
+#[uniffi::export]
+pub fn claim_env_token_key() -> String {
+ CLAIM_ENV_TOKEN_KEY.into()
+}
#[derive(Deserialize)]
struct ResourceList<T> {
@@ -45,6 +59,7 @@ impl CyclopsClient {
warmpool: None,
bind_deadline: Some(DEFAULT_CLAIM_BIND_DEADLINE_SECONDS),
ttl_seconds_after_created: None,
+ secret_ref: None,
lifecycle: None,
});
if spec.bind_deadline.is_none() {
@@ -55,6 +70,15 @@ impl CyclopsClient {
reason: "sandbox template name must not be empty".into(),
});
}
+ let secret_files = request.secret_files.filter(|files| !files.is_empty());
+ if let Some(files) = &secret_files {
+ if spec.secret_ref.is_some() {
+ return Err(SdkError::Configuration {
+ reason: "set either secret_files or spec.secret_ref, not both".into(),
+ });
+ }
+ validate_secret_file_keys(files)?;
+ }
let name = match request.name {
Some(name) => {
routes::validate_dns_label_for("claim name", &name)?;
@@ -62,6 +86,19 @@ impl CyclopsClient {
}
None => claim_name()?,
};
+ let namespace = pool.metadata.namespace.clone();
+ let secret_name = match &secret_files {
+ Some(files) => {
+ let secret_name = format!("{CLAIM_SECRET_NAME_PREFIX}{name}");
+ self.create_claim_secret(&namespace, &secret_name, &name, files)
+ .await?;
+ spec.secret_ref = Some(ClaimSecretRef {
+ name: secret_name.clone(),
+ });
+ Some(secret_name)
+ }
+ None => None,
+ };
let claim = Claim {
api_version: "osgym.cua.ai/v1alpha1".into(),
@@ -75,14 +112,23 @@ impl CyclopsClient {
spec,
status: None,
};
- let collection_url = routes::claim_collection(self.base_url(), &claim.metadata.namespace)?;
- send_json(
- self.as_ref(),
- "create claim",
- json_request("POST", collection_url, Some(to_json(&claim)?)),
- &[200, 201, 202],
- )
- .await
+ let created = match routes::claim_collection(self.base_url(), &claim.metadata.namespace)
+ .and_then(|url| Ok(json_request("POST", url, Some(to_json(&claim)?))))
+ {
+ Ok(request) => {
+ send_json(self.as_ref(), "create claim", request, &[200, 201, 202]).await
+ }
+ Err(error) => Err(error),
+ };
+ if created.is_err()
+ && let Some(secret_name) = &secret_name
+ {
+ // Best effort: the claim never existed, so nothing else will
+ // reference or garbage-collect this Secret. The original error
+ // is what the caller needs to see.
+ let _ = self.delete_claim_secret(&namespace, secret_name).await;
+ }
+ created
}
pub async fn list_claims(self: Arc<Self>, namespace: String) -> Result<Vec<Claim>, SdkError> {
@@ -108,6 +154,9 @@ impl CyclopsClient {
.await
}
+ /// Delete the claim and, when it references a claim-scoped Secret
+ /// (`secret_files`), that Secret too. The pool-operator also owner-refs
+ /// the Secret to the claim, so garbage collection is the backstop.
pub async fn delete_claim(self: Arc<Self>, claim: Claim) -> Result<(), SdkError> {
let item_url = self.claim_item_url(&claim)?;
send_unit(
@@ -116,7 +165,14 @@ impl CyclopsClient {
json_request("DELETE", item_url, None),
&[200, 202, 204, 404],
)
- .await
+ .await?;
+ if let Some(secret_ref) = &claim.spec.secret_ref
+ && secret_ref.name.starts_with(CLAIM_SECRET_NAME_PREFIX)
+ {
+ self.delete_claim_secret(&claim.metadata.namespace, &secret_ref.name)
+ .await?;
+ }
+ Ok(())
}
/// Push the claim's `spec.lifecycle.shutdownTime` forward. That absolute
@@ -199,6 +255,52 @@ impl CyclopsClient {
Ok(())
}
+ async fn create_claim_secret(
+ &self,
+ namespace: &str,
+ secret_name: &str,
+ claim_name: &str,
+ files: &HashMap<String, String>,
+ ) -> Result<(), SdkError> {
+ routes::validate_claim_secret_name(secret_name)?;
+ let collection_url = routes::claim_secret_collection(self.base_url(), namespace)?;
+ let body = to_json(&serde_json::json!({
+ "apiVersion": "v1",
+ "kind": "Secret",
+ "metadata": {
+ "name": secret_name,
+ "namespace": namespace,
+ "labels": { CLAIM_SECRET_CLAIM_LABEL: claim_name },
+ },
+ "type": "Opaque",
+ "stringData": files,
+ }))?;
+ // 409 is an error on purpose: an existing Secret of that name belongs
+ // to another claim attempt and must not be overwritten.
+ send_unit(
+ self,
+ "create claim secret",
+ json_request("POST", collection_url, Some(body)),
+ &[200, 201, 202],
+ )
+ .await
+ }
+
+ async fn delete_claim_secret(
+ &self,
+ namespace: &str,
+ secret_name: &str,
+ ) -> Result<(), SdkError> {
+ let item_url = routes::claim_secret_item(self.base_url(), namespace, secret_name)?;
+ send_unit(
+ self,
+ "delete claim secret",
+ json_request("DELETE", item_url, None),
+ &[200, 202, 204, 404],
+ )
+ .await
+ }
+
fn claim_item_url(&self, claim: &Claim) -> Result<Url, SdkError> {
routes::claim_item(
self.base_url(),
@@ -236,6 +338,26 @@ fn claim_name() -> Result<String, SdkError> {
})
}
+fn validate_secret_file_keys(files: &HashMap<String, String>) -> Result<(), SdkError> {
+ for key in files.keys() {
+ let valid = !key.is_empty()
+ && key.len() <= MAX_SECRET_KEY_BYTES
+ && key != "."
+ && key != ".."
+ && key
+ .bytes()
+ .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'.' | b'_'));
+ if !valid {
+ return Err(SdkError::Configuration {
+ reason: format!(
+ "secret file name {key:?} must be 1-{MAX_SECRET_KEY_BYTES} characters of [-._a-zA-Z0-9] and not . or .."
+ ),
+ });
+ }
+ }
+ Ok(())
+}
+
fn service_names(template: &Template) -> Vec<String> {
let mut names: Vec<String> = template
.spec
diff --git a/libs/fleet/sdk/src/fleets.rs b/libs/fleet/sdk/src/fleets.rs
index 960f414bcb..2f83ff258d 100644
--- a/libs/fleet/sdk/src/fleets.rs
+++ b/libs/fleet/sdk/src/fleets.rs
@@ -66,6 +66,7 @@ impl CyclopsClient {
spec: None,
name: None,
labels: Some(labels.clone()),
+ secret_files: None,
})
.await?;
claims.push(claim);
@@ -187,6 +188,7 @@ mod tests {
warmpool: None,
bind_deadline: None,
ttl_seconds_after_created: None,
+ secret_ref: None,
lifecycle: None,
},
status: None,
diff --git a/libs/fleet/sdk/src/lib.rs b/libs/fleet/sdk/src/lib.rs
index 7c56f73a7e..5a81e29185 100644
--- a/libs/fleet/sdk/src/lib.rs
+++ b/libs/fleet/sdk/src/lib.rs
@@ -15,8 +15,10 @@ mod transport;
mod types;
mod user_keys;
+pub use claims::claim_env_token_key;
pub use client::CyclopsClient;
pub use cyclops_sdk_schema::PreservedJson;
+pub use cyclops_sdk_schema::{CLAIM_ENV_TOKEN_KEY, CLAIM_SECRET_NAME_PREFIX, ClaimSecretRef};
pub use error::{
AccessTokenProviderError, HttpError, MAX_STATUS_BODY_BYTES, SdkBuildError, SdkError,
bounded_body,
diff --git a/libs/fleet/sdk/src/routes.rs b/libs/fleet/sdk/src/routes.rs
index 1cb2aa5386..9785bdf552 100644
--- a/libs/fleet/sdk/src/routes.rs
+++ b/libs/fleet/sdk/src/routes.rs
@@ -4,6 +4,8 @@ use url::Url;
const POOL_COLLECTION_PREFIX: &str = "api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/";
const CLAIM_COLLECTION_PREFIX: &str = "api/k8s/apis/osgym.cua.ai/v1alpha1/namespaces/";
const CLAIM_COLLECTION_SUFFIX: &str = "/osgymsandboxclaims";
+const SECRET_COLLECTION_PREFIX: &str = "api/k8s/api/v1/namespaces/";
+const SECRET_COLLECTION_SUFFIX: &str = "/secrets";
const POOL_COLLECTION_SUFFIX: &str = "/osgymsandboxwarmpools";
const TEMPLATE_COLLECTION_SUFFIX: &str = "/osgymsandboxtemplates";
const NAMESPACE_COLLECTION: &str = "api/namespaces";
@@ -257,6 +259,39 @@ pub fn claim_item(base: &Url, namespace: &str, name: &str) -> Result<Url, SdkErr
)
}
+/// Core Secrets collection in a pool namespace. The gateway only admits
+/// creating Opaque `cua-claim-*` Secrets here.
+pub fn claim_secret_collection(base: &Url, namespace: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ route(
+ base,
+ format!("{SECRET_COLLECTION_PREFIX}{namespace}{SECRET_COLLECTION_SUFFIX}"),
+ )
+}
+
+/// One claim-scoped Secret. Secret names are DNS subdomains, but claim secret
+/// names are `cua-claim-<claim>`, which is always a DNS label plus a prefix.
+pub fn claim_secret_item(base: &Url, namespace: &str, name: &str) -> Result<Url, SdkError> {
+ validate_dns_label_for("namespace", namespace)?;
+ validate_claim_secret_name(name)?;
+ route(
+ base,
+ format!("{SECRET_COLLECTION_PREFIX}{namespace}{SECRET_COLLECTION_SUFFIX}/{name}"),
+ )
+}
+
+pub(crate) fn validate_claim_secret_name(name: &str) -> Result<(), SdkError> {
+ let rest = name
+ .strip_prefix(cyclops_sdk_schema::CLAIM_SECRET_NAME_PREFIX)
+ .ok_or_else(|| SdkError::Configuration {
+ reason: format!(
+ "claim secret name must start with {}",
+ cyclops_sdk_schema::CLAIM_SECRET_NAME_PREFIX
+ ),
+ })?;
+ validate_dns_label_for("claim secret name", rest)
+}
+
pub fn service_url(
base: &Url,
namespace: &str,
diff --git a/libs/fleet/sdk/src/types.rs b/libs/fleet/sdk/src/types.rs
index b9e256587b..da935aa6b2 100644
--- a/libs/fleet/sdk/src/types.rs
+++ b/libs/fleet/sdk/src/types.rs
@@ -290,9 +290,7 @@ impl PartialEq for CreateTemplateRequest {
}
}
-#[derive(
- Clone, Debug, Serialize, Deserialize, uniffi::Record, uniffi_builder_derive::UniffiBuilder,
-)]
+#[derive(Clone, Serialize, Deserialize, uniffi::Record, uniffi_builder_derive::UniffiBuilder)]
#[uniffi_builder(crate::SdkBuildError)]
pub struct CreateClaimRequest {
pub pool: Pool,
@@ -309,6 +307,37 @@ pub struct CreateClaimRequest {
#[serde(default)]
#[uniffi(default = None)]
pub labels: Option<HashMap<String, String>>,
+ /// Files delivered into the bound sandbox under `/run/cua/<key>` (mode
+ /// 0600) once the claim binds, without restarting it. The key
+ /// `claim_env_token_key()` (`env-token`) carries the cua-env-driver token.
+ /// The client stores them in a claim-scoped `cua-claim-<claim>` Secret
+ /// that the claim references by `spec.secretRef`; `delete_claim` removes
+ /// it. The pool's template must set `vmTemplate.claimSecrets`. Values are
+ /// never serialized with the request nor printed by `Debug`.
+ #[serde(default, skip_serializing)]
+ #[uniffi(default = None)]
+ pub secret_files: Option<HashMap<String, String>>,
+}
+
+impl fmt::Debug for CreateClaimRequest {
+ fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
+ let secret_keys = self.secret_files.as_ref().map(|files| {
+ let mut keys: Vec<&str> = files.keys().map(String::as_str).collect();
+ keys.sort_unstable();
+ keys
+ });
+ formatter
+ .debug_struct("CreateClaimRequest")
+ .field("pool", &self.pool)
+ .field("spec", &self.spec)
+ .field("name", &self.name)
+ .field("labels", &self.labels)
+ .field(
+ "secret_files",
+ &secret_keys.map(|keys| (keys, "<redacted>")),
+ )
+ .finish()
+ }
}
impl PartialEq for CreateClaimRequest {
@@ -317,6 +346,7 @@ impl PartialEq for CreateClaimRequest {
&& schema_values_equal(&self.spec, &other.spec)
&& self.name == other.name
&& self.labels == other.labels
+ && self.secret_files == other.secret_files
}
}
diff --git a/libs/fleet/sdk/tests/claim_flow.rs b/libs/fleet/sdk/tests/claim_flow.rs
index bd8bae4f1f..a0a8ce4e5e 100644
--- a/libs/fleet/sdk/tests/claim_flow.rs
+++ b/libs/fleet/sdk/tests/claim_flow.rs
@@ -35,6 +35,7 @@ async fn creates_pending_demand_immediately_for_a_nonzero_unavailable_pool() {
spec: Some(spec.clone()),
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap(),
@@ -64,6 +65,7 @@ async fn create_claim_defaults_missing_bind_deadline_to_900_seconds() {
}),
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -90,6 +92,7 @@ async fn create_claim_preserves_explicit_bind_deadline() {
spec: Some(spec),
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -115,6 +118,7 @@ async fn zero_and_nonzero_pools_post_a_single_claim_create() {
spec: None,
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -221,6 +225,7 @@ async fn create_claim_uses_a_client_supplied_name_verbatim() {
spec: Some(spec.clone()),
name: Some("claim-1".into()),
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -243,6 +248,7 @@ async fn create_claim_rejects_an_invalid_client_supplied_name_before_any_request
spec: None,
name: Some("Not A DNS Label".into()),
labels: None,
+ secret_files: None,
})
.await,
Err(SdkError::InvalidResourceName { .. })
@@ -342,12 +348,14 @@ async fn generated_claim_names_are_unique_under_concurrency_and_fit_dns_labels()
spec: Some(claim_spec("short-template")),
name: None,
labels: None,
+ secret_files: None,
}),
client.create_claim(CreateClaimRequest {
pool,
spec: Some(claim_spec("short-template")),
name: None,
labels: None,
+ secret_files: None,
}),
);
assert!(first.is_ok());
@@ -388,6 +396,7 @@ async fn validation_and_malformed_responses_fail_without_unexpected_http() {
spec: None,
name: None,
labels: None,
+ secret_files: None,
})
.await,
Err(SdkError::InvalidResourceName { .. })
@@ -596,6 +605,7 @@ async fn default_template_ref_for_a_63_byte_pool_passes_through_without_dns_vali
spec: None,
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -623,6 +633,7 @@ async fn explicit_non_dns_template_ref_passes_through_but_empty_ref_is_rejected_
spec: Some(claim_spec(template_name)),
name: None,
labels: None,
+ secret_files: None,
})
.await
.unwrap();
@@ -639,6 +650,7 @@ async fn explicit_non_dns_template_ref_passes_through_but_empty_ref_is_rejected_
spec: Some(claim_spec("")),
name: None,
labels: None,
+ secret_files: None,
})
.await,
Err(SdkError::Configuration { .. })
@@ -707,3 +719,207 @@ async fn wait_claim_rejects_invalid_claim_identity_before_token_or_pool_lookup()
));
assert_eq!(http.request_count().await, 0);
}
+
+const SECRET_COLLECTION: &str =
+ "https://cyclops.example:8443/prefix/api/k8s/api/v1/namespaces/example-pool/secrets";
+const ENV_TOKEN_VALUE: &str = "env-token-value-must-not-leak";
+
+fn env_token_files() -> std::collections::HashMap<String, String> {
+ [(
+ cyclops_sdk::claim_env_token_key(),
+ ENV_TOKEN_VALUE.to_string(),
+ )]
+ .into()
+}
+
+fn secret_claim_request(files: std::collections::HashMap<String, String>) -> CreateClaimRequest {
+ CreateClaimRequest {
+ pool: pool(1),
+ spec: None,
+ name: Some("secret-claim".into()),
+ labels: None,
+ secret_files: Some(files),
+ }
+}
+
+#[tokio::test]
+async fn create_claim_with_secret_files_creates_the_secret_first_and_references_it() {
+ let mut spec = claim_spec("example-pool-template");
+ spec.secret_ref = Some(cyclops_sdk::ClaimSecretRef {
+ name: "cua-claim-secret-claim".into(),
+ });
+ let created = claim("secret-claim", spec, None);
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(json_response(201, &serde_json::json!({}))),
+ Ok(json_response(201, &created)),
+ ]));
+
+ assert_eq!(
+ client(Arc::clone(&http), 1, 1)
+ .create_claim(secret_claim_request(env_token_files()))
+ .await
+ .unwrap(),
+ created
+ );
+
+ let requests = http.authenticated_requests().await;
+ assert_eq!(requests.len(), 2);
+ assert_eq!(requests[0].method, "POST");
+ assert_eq!(requests[0].url, SECRET_COLLECTION);
+ let secret: serde_json::Value =
+ serde_json::from_slice(requests[0].body.as_deref().unwrap()).unwrap();
+ assert_eq!(
+ secret,
+ serde_json::json!({
+ "apiVersion": "v1",
+ "kind": "Secret",
+ "metadata": {
+ "name": "cua-claim-secret-claim",
+ "namespace": NAMESPACE,
+ "labels": { "osgym.cua.ai/claim": "secret-claim" },
+ },
+ "type": "Opaque",
+ "stringData": { "env-token": ENV_TOKEN_VALUE },
+ })
+ );
+
+ assert_eq!(requests[1].method, "POST");
+ assert_eq!(requests[1].url, CLAIM_COLLECTION);
+ let claim_body = requests[1].body.as_deref().unwrap();
+ let claim_json: serde_json::Value = serde_json::from_slice(claim_body).unwrap();
+ assert_eq!(
+ claim_json["spec"]["secretRef"],
+ serde_json::json!({ "name": "cua-claim-secret-claim" })
+ );
+ assert!(
+ !String::from_utf8_lossy(claim_body).contains(ENV_TOKEN_VALUE),
+ "the claim body must reference the Secret, never carry its value"
+ );
+}
+
+#[tokio::test]
+async fn failed_claim_create_deletes_the_orphaned_secret_and_returns_the_claim_error() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(json_response(201, &serde_json::json!({}))),
+ Ok(response(403, b"k8s request is not allowed")),
+ Ok(response(200, b"{}")),
+ ]));
+
+ let error = client(Arc::clone(&http), 1, 1)
+ .create_claim(secret_claim_request(env_token_files()))
+ .await
+ .unwrap_err();
+ assert!(
+ matches!(&error, SdkError::Status { operation, status: 403, .. } if operation == "create claim"),
+ "{error:?}"
+ );
+
+ let requests = http.authenticated_requests().await;
+ assert_eq!(requests.len(), 3);
+ assert_request(
+ &requests[2],
+ "DELETE",
+ &format!("{SECRET_COLLECTION}/cua-claim-secret-claim"),
+ None,
+ );
+}
+
+#[tokio::test]
+async fn an_existing_claim_secret_is_not_overwritten_and_no_claim_is_created() {
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(409, b"already exists")),
+ ]));
+
+ let error = client(Arc::clone(&http), 1, 1)
+ .create_claim(secret_claim_request(env_token_files()))
+ .await
+ .unwrap_err();
+ assert!(
+ matches!(&error, SdkError::Status { status: 409, .. }),
+ "{error:?}"
+ );
+ assert_eq!(http.authenticated_requests().await.len(), 1);
+}
+
+#[tokio::test]
+async fn delete_claim_also_deletes_its_claim_secret() {
+ let mut spec = claim_spec("example-pool-template");
+ spec.secret_ref = Some(cyclops_sdk::ClaimSecretRef {
+ name: "cua-claim-secret-claim".into(),
+ });
+ let current = claim("secret-claim", spec, None);
+ let http = Arc::new(ScriptedHttpClient::new([
+ Ok(token()),
+ Ok(response(200, b"{}")),
+ Ok(response(404, b"not found")),
+ ]));
+
+ client(Arc::clone(&http), 1, 1)
+ .delete_claim(current)
+ .await
+ .unwrap();
+
+ let requests = http.authenticated_requests().await;
+ assert_eq!(requests.len(), 2);
+ assert_request(
+ &requests[0],
+ "DELETE",
+ &format!("{CLAIM_COLLECTION}/secret-claim"),
+ None,
+ );
+ assert_request(
+ &requests[1],
+ "DELETE",
+ &format!("{SECRET_COLLECTION}/cua-claim-secret-claim"),
+ None,
+ );
+}
+
+#[tokio::test]
+async fn invalid_secret_file_names_and_conflicting_refs_fail_before_any_request() {
+ for key in ["", ".", "..", "a/b", "sp ace", &"k".repeat(254)] {
+ let http = Arc::new(ScriptedHttpClient::new([]));
+ let error = client(Arc::clone(&http), 1, 1)
+ .create_claim(secret_claim_request(
+ [(key.to_string(), "v".to_string())].into(),
+ ))
+ .await
+ .unwrap_err();
+ assert!(
+ matches!(error, SdkError::Configuration { .. }),
+ "{key:?}: {error:?}"
+ );
+ assert!(http.authenticated_requests().await.is_empty());
+ }
+
+ let mut request = secret_claim_request(env_token_files());
+ let mut spec = claim_spec("example-pool-template");
+ spec.secret_ref = Some(cyclops_sdk::ClaimSecretRef {
+ name: "cua-claim-other".into(),
+ });
+ request.spec = Some(spec);
+ let http = Arc::new(ScriptedHttpClient::new([]));
+ let error = client(Arc::clone(&http), 1, 1)
+ .create_claim(request)
+ .await
+ .unwrap_err();
+ assert!(matches!(error, SdkError::Configuration { .. }), "{error:?}");
+ assert!(http.authenticated_requests().await.is_empty());
+}
+
+#[test]
+fn create_claim_request_debug_and_serialization_redact_secret_values() {
+ let request = secret_claim_request(env_token_files());
+ let debug = format!("{request:?}");
+ assert!(debug.contains("env-token"), "{debug}");
+ assert!(!debug.contains(ENV_TOKEN_VALUE), "{debug}");
+ let json = serde_json::to_string(&request).unwrap();
+ assert!(!json.contains(ENV_TOKEN_VALUE), "{json}");
+ assert_eq!(
+ cyclops_sdk::claim_env_token_key(),
+ cyclops_sdk::CLAIM_ENV_TOKEN_KEY
+ );
+}
diff --git a/libs/fleet/sdk/tests/public_api.rs b/libs/fleet/sdk/tests/public_api.rs
index 38cf55137d..45003dafe9 100644
--- a/libs/fleet/sdk/tests/public_api.rs
+++ b/libs/fleet/sdk/tests/public_api.rs
@@ -335,11 +335,13 @@ fn resources_use_canonical_schema_specs_and_statuses() {
spec,
name,
labels,
+ secret_files,
} = request;
assert_pool_types(pool);
let _: Option<ClaimSpec> = spec;
let _: Option<String> = name;
let _: Option<HashMap<String, String>> = labels;
+ let _: Option<HashMap<String, String>> = secret_files;
}
let _: fn(Claim) = assert_claim_types;
@@ -366,6 +368,7 @@ fn resources_support_equality_and_kubernetes_camel_case_json() {
spec: Some(claim.spec.clone()),
name: None,
labels: None,
+ secret_files: None,
};
assert_eq!(pool, pool.clone());