{"record":{"id":"dd909aefc5fe674f","repo":"kubernetes/kops","slug":"cannot-apply-changes-to-disk-v","errorCode":null,"errorMessage":"cannot apply changes to Disk: %v","messagePattern":"cannot apply changes to Disk: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/gcetasks/disk.go","lineNumber":170,"sourceCode":"\t\t}\n\t\t// Danger: labels replace tags on instances; but thankfully volumes don't have tags\n\t\t//for _, k := range d.Tags {\n\t\t//\tlabelsRequest.Labels[k] = \"\"\n\t\t//}\n\t\tmaps.Copy(labelsRequest.Labels, d.Labels)\n\t\tmaps.Copy(labelsRequest.Labels, t.Cloud.Labels())\n\t\tmaps.Copy(labelsRequest.Labels, e.Labels)\n\t\tklog.V(2).Infof(\"Setting labels on disk %q: %v\", disk.Name, labelsRequest.Labels)\n\t\tif err = t.Cloud.Compute().Disks().SetLabels(t.Cloud.Project(), *e.Zone, disk.Name, labelsRequest); err != nil {\n\t\t\treturn fmt.Errorf(\"error setting labels on created Disk: %v\", err)\n\t\t}\n\t\tchanges.Labels = nil\n\t}\n\n\tif a != nil && changes != nil {\n\t\tempty := &Disk{}\n\t\tif !reflect.DeepEqual(empty, changes) {\n\t\t\treturn fmt.Errorf(\"cannot apply changes to Disk: %v\", changes)\n\t\t}\n\t}\n\n\treturn nil\n}\n\ntype terraformDisk struct {\n\tName                  *string           `cty:\"name\"`\n\tVolumeType            *string           `cty:\"type\"`\n\tSizeGB                *int64            `cty:\"size\"`\n\tProvisionedIops       *int64            `cty:\"provisioned_iops\"`\n\tProvisionedThroughput *int64            `cty:\"provisioned_throughput\"`\n\tZone                  *string           `cty:\"zone\"`\n\tLabels                map[string]string `cty:\"labels\"`\n}\n\nfunc (*Disk) RenderTerraform(t *terraform.TerraformTarget, a, e, changes *Disk) error {\n\tcloud := t.Cloud.(gce.GCECloud)","sourceCodeStart":152,"sourceCodeEnd":188,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/gcetasks/disk.go#L152-L188","documentation":"After applying labels, RenderGCE checks whether any unhandled changes remain; if the changes struct is not DeepEqual to an empty Disk, the task cannot reconcile them and refuses to proceed rather than silently ignoring drift. This is a defensive guard in the GCE Disk task's apply logic.","triggerScenarios":"An update to a Disk task produced changes fields that the earlier Insert/SetLabels code paths did not consume (e.g. a new field added to the Disk spec without corresponding apply logic, or fi.ComputeChanges returning fields RenderGCE doesn't handle).","commonSituations":"Upgrading kOps versions where a new Disk field is set in the cluster spec but the GCE task cannot update it in place; hand-edited cluster spec changing an immutable disk property (e.g. size/type) on an existing disk.","solutions":["Read the %v of changes to see which field is unsupported","For immutable properties (size/type), delete and recreate the disk/instance group instead of updating in place","Remove the unsupported field from the cluster spec if unintended","File/fix a kOps bug if the field is new and lacks GCE apply support"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// before apply, diff desired vs actual and fail on fields the GCE task can't update\nunsupported := setDifference(desiredFields, handledFields) // e.g. size, type\nif len(unsupported) > 0 { return fmt.Errorf(\"immutable fields need recreation: %v\", unsupported) }","typeGuard":null,"tryCatchPattern":"if err := render(...); err != nil {\n  var changesErr *ChangesError\n  if errors.As(err, &changesErr) { /* plan disk recreation instead of update */ }\n}","preventionTips":["Treat disk size/type as immutable; recreate to change","Keep kOps and cluster spec schema versions aligned","Never hand-edit fields not supported by the GCE task"],"tags":["gcp","gce","disk","reconciliation"],"backgroundTag":"unsupported-in-place-update","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}