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): remove implicit image pull secret (#7803)
r33drichardsb31dadedb611
diff --git a/libs/fleet/terraform-provider-fleets/MIGRATION.md b/libs/fleet/terraform-provider-fleets/MIGRATION.mdindex 632d20a429..26d09dc64e 100644--- a/libs/fleet/terraform-provider-fleets/MIGRATION.md+++ b/libs/fleet/terraform-provider-fleets/MIGRATION.md@@ -46,3 +46,16 @@ Static pools keep `replicas` and omit `autoscaling`. In autoscaling mode, donot configure `replicas`; it reports the current pool target after apply andrefresh. Review the plan before changing modes because switching to static setsthe pool to the configured `replicas` value.++## Image pull secrets in v0.3.0++Provider v0.3.0 removes the historical implicit `ecr-credentials` default.+Omitting `image_pull_secret` now omits `imagePullSecret` from the Fleet template.+Pools that use a private image must configure their secret explicitly:++```terraform+resource "fleets_pool" "private" {+ # ...+ image_pull_secret = "ecr-credentials"+}+```diff --git a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md b/libs/fleet/terraform-provider-fleets/docs/resources/pool.mdindex f26df158a8..ff263f04be 100644--- a/libs/fleet/terraform-provider-fleets/docs/resources/pool.md+++ b/libs/fleet/terraform-provider-fleets/docs/resources/pool.md@@ -39,9 +39,8 @@ 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.+Omit `image_pull_secret` to omit `imagePullSecret` from the Fleet template and+let Kubernetes pull an anonymously accessible image.```terraformresource "fleets_pool" "public_gvisor" {@@ -49,7 +48,6 @@ resource "fleets_pool" "public_gvisor" {cpu_cores = 4memory = "8Gi"container_disk_image = "ghcr.io/example/public-image@sha256:..."- image_pull_secret = ""runtime = "gvisor"autoscaling {@@ -67,7 +65,7 @@ resource "fleets_pool" "public_gvisor" {- `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; omitted values default to `ecr-credentials`. Set `""` to omit the field for an anonymous public-image pull.+- `image_pull_secret` - Optional image pull secret. Omit it 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 4d83f552e7..57556afcb4 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@@ -58,10 +58,10 @@"name": "image_pull_secret","go_name": "ImagePullSecret","value_type": "string",- "mode": "optional_computed",+ "mode": "optional","cr": "template","crd_path": "spec.vmTemplate.imagePullSecret",- "description": "Kubernetes image pull secret. Defaults to ecr-credentials when omitted; set to an empty string to omit imagePullSecret for anonymous public-image pulls."+ "description": "Kubernetes image pull secret. Omit this argument 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 b4d5bef16f..0004bd75f1 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 when omitted; set to an empty string to omit imagePullSecret for anonymous public-image pulls."},+ "image_pull_secret": schema.StringAttribute{Optional: true, Description: "Kubernetes image pull secret. Omit this argument 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 30c23baa99..5d309b3dec 100644--- a/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go+++ b/libs/fleet/terraform-provider-fleets/internal/provider/pool_resource.go@@ -361,13 +361,9 @@ func (m poolResourceModel) toSDKTemplateSpec(ctx context.Context, diagnostics *dfunc configuredImagePullSecret(value types.String) *string {if value.IsNull() || value.IsUnknown() {- defaultSecret := "ecr-credentials"- return &defaultSecret- }- configured := value.ValueString()- if configured == "" {return nil}+ configured := value.ValueString()return &configured}@@ -456,7 +452,11 @@ 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(optionalString(vmTemplate.ImagePullSecret))+ if vmTemplate.ImagePullSecret == nil {+ m.ImagePullSecret = types.StringNull()+ } else {+ m.ImagePullSecret = types.StringValue(*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 30d91dc8a2..fde839157e 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@@ -6,6 +6,7 @@ import ("github.com/hashicorp/terraform-plugin-framework/attr""github.com/hashicorp/terraform-plugin-framework/diag"+ "github.com/hashicorp/terraform-plugin-framework/resource/schema""github.com/hashicorp/terraform-plugin-framework/types""github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk_schema""github.com/trycua/cloud/cyclops-cs/sdk-bindings/go-uniffi/fleet_sdk"@@ -36,6 +37,16 @@ func testAutoscalingValue(initial int64) types.Object {})}+func TestPoolResourceSchemaImagePullSecretIsOptionalOnly(t *testing.T) {+ attribute, ok := poolResourceSchema().Attributes["image_pull_secret"].(schema.StringAttribute)+ if !ok {+ t.Fatalf("image_pull_secret schema type = %T, want schema.StringAttribute", attribute)+ }+ if !attribute.Optional || attribute.Computed {+ t.Fatalf("image_pull_secret optional = %t, computed = %t; want optional-only", attribute.Optional, attribute.Computed)+ }+}+func TestPoolResourceModelToSDKCreatePoolRequest(t *testing.T) {model := examplePoolModel()@@ -205,7 +216,7 @@ func TestPoolResourceModelToSDKCreateTemplateRequest(t *testing.T) {}}-func TestPoolResourceModelToSDKPublicImageOmitsPullSecret(t *testing.T) {+func TestPoolResourceModelToSDKEmptyPullSecretPreservesConfiguredValue(t *testing.T) {model := examplePoolModel()model.ImagePullSecret = types.StringValue("")@@ -214,12 +225,13 @@ func TestPoolResourceModelToSDKPublicImageOmitsPullSecret(t *testing.T) {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)+ secret := request.Spec.VmTemplate.ImagePullSecret+ if secret == nil || *secret != "" {+ t.Fatalf("imagePullSecret = %v, want configured empty string", secret)}}-func TestPoolResourceModelToSDKUnconfiguredPullSecretKeepsECRDefault(t *testing.T) {+func TestPoolResourceModelToSDKUnconfiguredPullSecretIsOmitted(t *testing.T) {for name, value := range map[string]types.String{"null": types.StringNull(),"unknown": types.StringUnknown(),@@ -233,9 +245,8 @@ func TestPoolResourceModelToSDKUnconfiguredPullSecretKeepsECRDefault(t *testing.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)+ if request.Spec.VmTemplate.ImagePullSecret != nil {+ t.Fatalf("imagePullSecret = %v, want omitted", request.Spec.VmTemplate.ImagePullSecret)}})}@@ -301,8 +312,8 @@ func TestPoolResourceModelFromSDKPublicImagePreservesOmittedPullSecret(t *testinif diagnostics.HasError() {t.Fatalf("unexpected diagnostics: %v", diagnostics)}- if model.ImagePullSecret.ValueString() != "" {- t.Fatalf("image_pull_secret = %q, want empty string", model.ImagePullSecret.ValueString())+ if !model.ImagePullSecret.IsNull() {+ t.Fatalf("image_pull_secret = %v, want null", model.ImagePullSecret)}}