{"record":{"id":"d5a46d18d1152280","repo":"kubernetes/kops","slug":"instancegroups-update-not-supported-for-server-si","errorCode":null,"errorMessage":"InstanceGroups::Update not supported for server-side client","messagePattern":"InstanceGroups::Update not supported for server-side client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/instancegroups.go","lineNumber":104,"sourceCode":"func (c *instanceGroups) List(ctx context.Context, options metav1.ListOptions) (*kopsapi.InstanceGroupList, error) {\n\tlist := &kopsapi.InstanceGroupList{}\n\titems, err := c.base.List(ctx, list.Items, options)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tlist.Items = items.([]kopsapi.InstanceGroup)\n\tfor i := range list.Items {\n\t\tc.addLabels(&list.Items[i])\n\t}\n\treturn list, nil\n}\n\nfunc (c *instanceGroups) Create(ctx context.Context, g *kopsapi.InstanceGroup, opts metav1.CreateOptions) (*kopsapi.InstanceGroup, error) {\n\treturn nil, fmt.Errorf(\"InstanceGroups::Create not supported for server-side client\")\n}\n\nfunc (c *instanceGroups) Update(ctx context.Context, g *kopsapi.InstanceGroup, opts metav1.UpdateOptions) (*kopsapi.InstanceGroup, error) {\n\treturn nil, fmt.Errorf(\"InstanceGroups::Update not supported for server-side client\")\n}\n\nfunc (c *instanceGroups) Delete(ctx context.Context, name string, options metav1.DeleteOptions) error {\n\treturn fmt.Errorf(\"InstanceGroups::Delete not supported for server-side client\")\n}\n\nfunc (r *instanceGroups) DeleteCollection(ctx context.Context, options metav1.DeleteOptions, listOptions metav1.ListOptions) error {\n\treturn fmt.Errorf(\"InstanceGroups::DeleteCollection not supported for server-side client\")\n}\n\nfunc (r *instanceGroups) Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) {\n\treturn nil, fmt.Errorf(\"InstanceGroups::Watch not supported for server-side client\")\n}\n\nfunc (r *instanceGroups) Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts metav1.PatchOptions, subresources ...string) (result *kopsapi.InstanceGroup, err error) {\n\treturn nil, fmt.Errorf(\"InstanceGroups::Patch not supported for server-side client\")\n}\n","sourceCodeStart":86,"sourceCodeEnd":122,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/instancegroups.go#L86-L122","documentation":"The kops server-side API client for InstanceGroups deliberately implements only read (List/Get) and Create... actually only List/Get-style operations; Update is intentionally unimplemented, so any attempt to update an InstanceGroup through this client fails immediately with this sentinel error rather than silently performing a partial update. It fires when code holding a server-side clientset calls InstanceGroupsFor(cluster).Update; callers must use the VFS-based client or a real Kubernetes client for updates.","triggerScenarios":"Calling instanceGroups.Update(ctx, ig, metav1.UpdateOptions{}) after modifying an InstanceGroup object fetched via Get/List, e.g. relabeling or resizing from controller code.","commonSituations":"Porting `kops edit ig`-style mutation or drain/rolling-update automation into the controller; applying desired-state reconciliation to instance groups.","solutions":["Apply instance group changes via the kops CLI (kops replace -f ig.yaml; kops update cluster --yes; kops rolling-update cluster)","Use a VFS-backed clientset outside the controller if programmatic updates are needed","Emit a reconciliation event/annotation and let an external tool perform the update"],"exampleFix":"// before\n_, err := igs.Update(ctx, modifiedIG, metav1.UpdateOptions{})\n// after\n// $ kops replace -f modified-ig.yaml && kops update cluster --yes\nig, err := igs.Get(ctx, modifiedIG.Name, metav1.GetOptions{})","handlingStrategy":"try-catch","validationCode":"if isReadOnlyInstanceGroupClient(igs) {\n  return errors.New(\"instance group updates must be applied via kops replace/update cluster\")\n}","typeGuard":null,"tryCatchPattern":"_, err := igs.Update(ctx, g, metav1.UpdateOptions{})\nif err != nil && strings.Contains(err.Error(), \"Update not supported\") {\n  // marshal g to YAML, then: kops replace -f - && kops update cluster --yes\n  return replaceInstanceGroupViaCLI(ctx, g)\n}","preventionTips":["Apply desired instance group state via YAML + kops replace","Do not implement in-controller reconciliation writes to instance groups","Remember Get/List are the only supported operations server-side"],"tags":["go","unsupported-operation","kops","read-only"],"backgroundTag":"operation-not-supported-by-client","analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T07:17:12.445Z"}