{"record":{"id":"a882040c55acc01e","repo":"kubernetes/kops","slug":"instancegroups-delete-not-supported-for-server-si","errorCode":null,"errorMessage":"InstanceGroups::Delete not supported for server-side client","messagePattern":"InstanceGroups::Delete not supported for server-side client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/instancegroups.go","lineNumber":108,"sourceCode":"\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":90,"sourceCodeEnd":122,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/instancegroups.go#L90-L122","documentation":"Delete on the server-side instanceGroups client is a deliberate stub: removing instance groups is a provisioning operation owned by kops CLI tooling, not the controller, so it always fails with this error.","triggerScenarios":"Calling instanceGroups.Delete(ctx, name, metav1.DeleteOptions{}) on the controller's interface, e.g. an auto-removal of empty node pools inside kops-controller.","commonSituations":"Porting `kops delete ig` logic into an operator; writing garbage-collection routines that prune unused instance groups at runtime.","solutions":["Delete instance groups via the CLI: kops delete ig <name> --yes, then kops update cluster --yes and rolling-update","Trigger deletion externally (CI, operator invoking kops) instead of in-process","Keep the controller read-only with respect to instance group lifecycle"],"exampleFix":"// before\nerr := igs.Delete(ctx, \"nodepool-a\", metav1.DeleteOptions{})\n// after\n// $ kops delete ig nodepool-a --name mycluster.example.com --yes\nerr := nil // controller only reads: igs.Get(ctx, \"nodepool-a\", metav1.GetOptions{})","handlingStrategy":"validation","validationCode":"if isReadOnlyInstanceGroupClient(igs) {\n  return errors.New(\"instance group deletion must be done via `kops delete ig` CLI\")\n}","typeGuard":null,"tryCatchPattern":"err := igs.Delete(ctx, name, metav1.DeleteOptions{})\nif err != nil && strings.Contains(err.Error(), \"Delete not supported\") {\n  // delegate: kops delete ig <name> --yes\n  return deleteInstanceGroupViaCLI(ctx, name)\n}","preventionTips":["Route instance group deletions through CLI with explicit confirmation","Keep controllers free of destructive instance group operations","Gate any automated deletion behind a separate, auditable tool"],"tags":["go","unsupported-operation","kops","destructive-operation"],"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-12T12:17:11.808Z"}