Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
fix(fleets): unblock public gVisor pools (#7799)
r33drichardsb89e4fc103ee
diff --git a/libs/fleet/backend/auth/pool_admission_test.rego b/libs/fleet/backend/auth/pool_admission_test.regoindex d47a29852f..faf10937e5 100644--- a/libs/fleet/backend/auth/pool_admission_test.rego+++ b/libs/fleet/backend/auth/pool_admission_test.rego@@ -8,6 +8,8 @@ native_path := "apis/osgym.cua.ai/v1alpha1/namespaces/ns-a/osgymsandboxtemplatesallowed_image := "public.ecr.aws/k5j5w0x5/cua-ubuntu-24.04:latest"+public_ghcr_digest := "ghcr.io/trycua/gameworld-autoresearch@sha256:d626893f7bc3c42603557e8ae2d9fdf8ca6ce4c671c1c5958cdba2152674f7ed"+osworld_v2_digest := "296062593712.dkr.ecr.us-west-2.amazonaws.com/osworld-v2-ubuntu-x86@sha256:6f981825c5970027df510006fcfc1ef7a502d2911f69ed9884f7f217007931dd"omarchy_digest := "296062593712.dkr.ecr.us-west-2.amazonaws.com/omarchy-workspace@sha256:c9cdba09d8cd2f742b9e9fa3818ca29dbcb66ee40edd057621e2987098226950"@@ -140,6 +142,26 @@ test_vm_template_ecr_secret_allowlisted_image_allowed {}}+test_native_vm_template_public_ghcr_without_pull_secret_allowed {+ pool_admission.allow with input as {+ "method": "POST",+ "params": {"path": native_path},+ "body": sprintf(`{"spec":{"vmTemplate":{"containerDiskImage":%q,"runtime":"gvisor"}}}`, [public_ghcr_digest]),+ "user": non_admin,+ "flags": non_admin_flags,+ }+}++test_native_vm_template_public_ghcr_with_empty_pull_secret_denied {+ not pool_admission.allow with input as {+ "method": "POST",+ "params": {"path": native_path},+ "body": sprintf(`{"spec":{"vmTemplate":{"containerDiskImage":%q,"imagePullSecret":"","runtime":"gvisor"}}}`, [public_ghcr_digest]),+ "user": non_admin,+ "flags": non_admin_flags,+ }+}+test_macos_runtime_denied_for_non_admin {not pool_admission.allow with input as {"method": "POST",diff --git a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md b/libs/fleet/terraform-provider-fleets/docs/resources/pool.mdindex eeed30d8cd..f26df158a8 100644--- a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md+++ b/libs/fleet/terraform-provider-fleets/docs/resources/pool.md@@ -37,6 +37,29 @@ resource "fleets_pool" "linux_autoscaled" {}```+## Public image without registry credentials++Set `image_pull_secret` to an empty string to omit `imagePullSecret` from the+Fleet template and let Kubernetes pull an anonymously accessible image. Leaving+the argument unset retains the `ecr-credentials` default.++```terraform+resource "fleets_pool" "public_gvisor" {+ name = "public-gvisor"+ cpu_cores = 4+ memory = "8Gi"+ container_disk_image = "ghcr.io/example/public-image@sha256:..."+ image_pull_secret = ""+ runtime = "gvisor"++ autoscaling {+ min_pool_size = 0+ initial_pool_size = 0+ max_pool_size = 20+ }+}+```+## Arguments- `name` - Pool and namespace DNS label. Changing it replaces the resource.@@ -44,7 +67,7 @@ resource "fleets_pool" "linux_autoscaled" {- `cpu_cores` - Virtual CPUs per sandbox.- `memory` - Kubernetes memory quantity per sandbox.- `container_disk_image` - OCI containerDisk or runtime image.-- `image_pull_secret` - Image pull secret; defaults to `ecr-credentials`.+- `image_pull_secret` - Image pull secret; omitted values default to `ecr-credentials`. Set `""` to omit the field for an anonymous public-image pull.- `runtime` - `kubevirt`, `macos`, or `gvisor`; defaults to `kubevirt`.- `firmware` - `bios` or `efi`; defaults to `bios`.- `readiness_probe_json` / `liveness_probe_json` - Kubernetes probe objects encoded as JSON.diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json b/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.jsonindex 8d90bcb323..4d83f552e7 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json+++ b/libs/fleet/terraform-provider-fleets/internal/provider/generate/pool_mapping.json@@ -61,7 +61,7 @@"mode": "optional_computed","cr": "template","crd_path": "spec.vmTemplate.imagePullSecret",- "description": "Kubernetes image pull secret. Defaults to ecr-credentials."+ "description": "Kubernetes image pull secret. Defaults to ecr-credentials when omitted; set to an empty string to omit imagePullSecret for anonymous public-image pulls."},{"name": "runtime",diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.goindex dab6da2b3e..b4d5bef16f 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_generated.go@@ -58,7 +58,7 @@ func poolResourceSchema() schema.Schema {"cpu_cores": schema.Int64Attribute{Required: true, Validators: []validator.Int64{int64validator.AtLeast(1)}},"memory": schema.StringAttribute{Required: true},"container_disk_image": schema.StringAttribute{Required: true, Description: "KubeVirt containerDisk OCI image (runtime=kubevirt) or the sandbox pod image ref (runtime=macos/gvisor)."},- "image_pull_secret": schema.StringAttribute{Optional: true, Computed: true, Description: "Kubernetes image pull secret. Defaults to ecr-credentials."},+ "image_pull_secret": schema.StringAttribute{Optional: true, Computed: true, Description: "Kubernetes image pull secret. Defaults to ecr-credentials when omitted; set to an empty string to omit imagePullSecret for anonymous public-image pulls."},"runtime": schema.StringAttribute{Optional: true, Computed: true, Description: "Pool backend runtime. \"kubevirt\" (default) reconciles each sandbox into a KubeVirt VM. \"macos\" reconciles it into a macOS sandbox (an agent-sandbox Sandbox on a macOS node); \"gvisor\" into a gVisor (runsc) pod on the gVisor K3s workers (also an agent-sandbox Sandbox). For the pod runtimes containerDiskImage is the pod image ref and firmware/cpuCores/memory are advisory.", Validators: []validator.String{stringvalidator.OneOf("gvisor", "kubevirt", "macos")}},"firmware": schema.StringAttribute{Optional: true, Computed: true, Description: "VM firmware. Use \"efi\" for GPT/UEFI-only guest images (e.g. the dockur-built Windows desktop-workspace); \"bios\" is KubeVirt's default and what the Linux workspace images boot with.", Validators: []validator.String{stringvalidator.OneOf("bios", "efi")}},"readiness_probe_json": schema.StringAttribute{Optional: true, CustomType: jsontypes.NormalizedType{}, Description: "JSON object for the VMI readinessProbe."},diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.goindex 2eb21fc840..30c23baa99 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go@@ -347,21 +347,30 @@ func (m poolResourceModel) toSDKTemplateSpec(ctx context.Context, diagnostics *dvalue := cyclops_sdk_schema.FirmwareEfifirmware = &value}- imagePullSecret := m.ImagePullSecret.ValueString()- if imagePullSecret == "" {- imagePullSecret = "ecr-credentials"- }+ imagePullSecret := configuredImagePullSecret(m.ImagePullSecret)cpuCores := uint32(m.CPUCores.ValueInt64())memory := m.Memory.ValueString()probes := m.toSDKProbes(diagnostics)return cyclops_sdk_schema.OsGymSandboxTemplateSpec{VmTemplate: cyclops_sdk_schema.VmTemplate{- Runtime: runtime, ContainerDiskImage: m.ContainerDiskImage.ValueString(), ImagePullSecret: &imagePullSecret,+ Runtime: runtime, ContainerDiskImage: m.ContainerDiskImage.ValueString(), ImagePullSecret: imagePullSecret,CpuCores: &cpuCores, Memory: &memory, Firmware: firmware, Probes: probes, Services: &services,},}}+func configuredImagePullSecret(value types.String) *string {+ if value.IsNull() || value.IsUnknown() {+ defaultSecret := "ecr-credentials"+ return &defaultSecret+ }+ configured := value.ValueString()+ if configured == "" {+ return nil+ }+ return &configured+}+func (m poolResourceModel) toSDKProbes(diagnostics *diag.Diagnostics) **cyclops_sdk_schema.PreservedJson {probes := map[string]json.RawMessage{}decodeProbe("readinessProbe", m.ReadinessProbeJSON, probes, diagnostics)@@ -447,7 +456,7 @@ func (m *poolResourceModel) fromSDKTemplate(ctx context.Context, template *fleetm.CPUCores = types.Int64Value(optionalUint32(vmTemplate.CpuCores))m.Memory = types.StringValue(optionalString(vmTemplate.Memory))m.ContainerDiskImage = types.StringValue(vmTemplate.ContainerDiskImage)- m.ImagePullSecret = types.StringValue(defaultString(vmTemplate.ImagePullSecret, "ecr-credentials"))+ m.ImagePullSecret = types.StringValue(optionalString(vmTemplate.ImagePullSecret))m.Runtime = types.StringValue(runtimeString(vmTemplate.Runtime))m.Firmware = types.StringValue(firmwareString(vmTemplate.Firmware))probes := sdkProbes(vmTemplate.Probes, diagnostics)diff --git a/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go b/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.goindex b12e415d1a..30d91dc8a2 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_sdk_test.go@@ -205,6 +205,42 @@ func TestPoolResourceModelToSDKCreateTemplateRequest(t *testing.T) {}}+func TestPoolResourceModelToSDKPublicImageOmitsPullSecret(t *testing.T) {+ model := examplePoolModel()+ model.ImagePullSecret = types.StringValue("")++ var diagnostics diag.Diagnostics+ request := model.toSDKCreateTemplateRequest(context.Background(), &diagnostics)+ if diagnostics.HasError() {+ t.Fatalf("unexpected diagnostics: %v", diagnostics)+ }+ if request.Spec.VmTemplate.ImagePullSecret != nil {+ t.Fatalf("imagePullSecret = %v, want omitted for a public image", request.Spec.VmTemplate.ImagePullSecret)+ }+}++func TestPoolResourceModelToSDKUnconfiguredPullSecretKeepsECRDefault(t *testing.T) {+ for name, value := range map[string]types.String{+ "null": types.StringNull(),+ "unknown": types.StringUnknown(),+ } {+ t.Run(name, func(t *testing.T) {+ model := examplePoolModel()+ model.ImagePullSecret = value++ var diagnostics diag.Diagnostics+ request := model.toSDKCreateTemplateRequest(context.Background(), &diagnostics)+ if diagnostics.HasError() {+ t.Fatalf("unexpected diagnostics: %v", diagnostics)+ }+ secret := request.Spec.VmTemplate.ImagePullSecret+ if secret == nil || *secret != "ecr-credentials" {+ t.Fatalf("imagePullSecret = %v, want ecr-credentials", secret)+ }+ })+ }+}+func TestPoolResourceModelFromSDKObjects(t *testing.T) {replicas := uint32(2)readyReplicas := uint32(1)@@ -254,6 +290,22 @@ func TestPoolResourceModelFromSDKObjects(t *testing.T) {}}+func TestPoolResourceModelFromSDKPublicImagePreservesOmittedPullSecret(t *testing.T) {+ template := fleet_sdk.Template{Spec: cyclops_sdk_schema.OsGymSandboxTemplateSpec{+ VmTemplate: cyclops_sdk_schema.VmTemplate{ContainerDiskImage: "ghcr.io/example/public@sha256:deadbeef"},+ }}++ var model poolResourceModel+ var diagnostics diag.Diagnostics+ model.fromSDKTemplate(context.Background(), &template, &diagnostics)+ if diagnostics.HasError() {+ t.Fatalf("unexpected diagnostics: %v", diagnostics)+ }+ if model.ImagePullSecret.ValueString() != "" {+ t.Fatalf("image_pull_secret = %q, want empty string", model.ImagePullSecret.ValueString())+ }+}+func TestPoolResourceModelFromSDKAutoscalingPreservesLiveReplicas(t *testing.T) {minPoolSize := uint32(0)initialPoolSize := uint32(2)