{"record":{"id":"f12b044034fccbc4","repo":"kubernetes/kops","slug":"instancegroups-create-not-supported-for-server-si","errorCode":null,"errorMessage":"InstanceGroups::Create not supported for server-side client","messagePattern":"InstanceGroups::Create not supported for server-side client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/instancegroups.go","lineNumber":100,"sourceCode":"\t}\n\tig.ObjectMeta.Labels[kopsapi.LabelClusterName] = c.clusterName\n}\n\nfunc (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","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/instancegroups.go#L82-L118","documentation":"The server-side clientset intentionally does not support creating InstanceGroups: the in-cluster kops-controller API only exposes read-only list/get plus limited flows. Calling Create always fails here, by design.","triggerScenarios":"Calling instanceGroups.Create(ctx, ig, metav1.CreateOptions{}) on the controller's instance group interface, e.g. from code that provisioned node pools on the fly.","commonSituations":"Reusing CLI autoscaling/rolling-update code inside the controller; attempting dynamic node pool creation from a controller reconciliation loop.","solutions":["Create instance groups via `kops create ig`/`kops replace -f ig.yaml` and let the controller only observe them","Use a VFS-backed clientset in a CLI/tool context if programmatic creation is required","Refactor the controller to treat instance groups as immutable inputs"],"exampleFix":"// before\nig, err := igs.Create(ctx, newInstanceGroup, metav1.CreateOptions{})\n// after\n// $ kops create -f ig.yaml --name mycluster.example.com\nig, err := igs.Get(ctx, \"nodes\", metav1.GetOptions{})","handlingStrategy":"try-catch","validationCode":"if isReadOnlyInstanceGroupClient(igs) {\n  return errors.New(\"instance group creation must go through the kops CLI or a VFS-backed clientset\")\n}","typeGuard":null,"tryCatchPattern":"ig, err := igs.Create(ctx, g, metav1.CreateOptions{})\nif err != nil && strings.Contains(err.Error(), \"Create not supported\") {\n  // write ig.yaml and shell out: kops create -f ig.yaml --name <cluster>\n  return createInstanceGroupViaCLI(ctx, g)\n}","preventionTips":["Manage instance groups declaratively via kops CLI, never at controller runtime","Treat the controller's instance group interface as read-only (Get/List only)","Add a lint/test asserting controller code does not call Create/Update/Delete"],"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"}