{"record":{"id":"83366723a7199362","repo":"kubernetes/kops","slug":"instancegroups-watch-not-supported-for-server-sid","errorCode":null,"errorMessage":"InstanceGroups::Watch not supported for server-side client","messagePattern":"InstanceGroups::Watch not supported for server-side client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/instancegroups.go","lineNumber":116,"sourceCode":"\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":98,"sourceCodeEnd":122,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/instancegroups.go#L98-L122","documentation":"Watch is not implemented on the server-side instanceGroups wrapper in kops-controller's clientset. The controller does not stream watch events for InstanceGroups through this client, so Watch unconditionally returns this sentinel error and a nil watch.Interface. It is a deliberate design limitation, not a transient failure.","triggerScenarios":"Calling ctxClient.InstanceGroups().Watch(ctx, metav1.ListOptions{}), or wiring this resource into a watch/informer loop (e.g. informers, watch.Until, cache.ListWatch) that expects a functioning Watch endpoint.","commonSituations":"Building a custom controller loop over InstanceGroups with informers; switching from the standard kops clientset to the controller server-side clientset and inheriting watch-based code; polling tools that fall back to watch for change detection.","solutions":["Poll with List(ctx, metav1.ListOptions{}) on a ticker instead of using Watch","Use a separate informer/watch built on the standard Kubernetes clientset for InstanceGroups","Only call Watch behind a capability check that verifies the clientset supports it","Implement Watch in cmd/kops-controller/pkg/controllerclientset/instancegroups.go if streaming is truly required"],"exampleFix":"// before\nwatcher, err := client.InstanceGroups().Watch(ctx, metav1.ListOptions{})\nif err != nil { return err }\nfor ev := range watcher.ResultChan() { ... }\n// after\nticker := time.NewTicker(30 * time.Second)\nfor {\n\tselect {\n\tcase <-ctx.Done():\n\t\treturn ctx.Err()\n\tcase <-ticker.C:\n\t\tgroups, err := client.InstanceGroups().List(ctx, metav1.ListOptions{})\n\t\tif err != nil { return err }\n\t\t// process groups\n\t}\n}","handlingStrategy":"fallback","validationCode":"if _, ok := igClient.(interface{ Watch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error) }); !ok {\n\tusePollingFallback = true\n}\n","typeGuard":"func supportsWatch(v interface{}) bool {\n\tw, ok := v.(interface {\n\t\tWatch(ctx context.Context, opts metav1.ListOptions) (watch.Interface, error)\n\t})\n\t_ = w\n\treturn ok\n}","tryCatchPattern":"watcher, err := igClient.Watch(ctx, metav1.ListOptions{})\nif err != nil {\n\tif strings.Contains(err.Error(), \"not supported for server-side client\") {\n\t\treturn pollInstanceGroups(ctx, 30*time.Second) // fallback: periodic List\n\t}\n\treturn err\n}","preventionTips":["Do not wire the controller clientset into informers or watch-based loops","Use List-on-a-ticker polling for change detection with this clientset","Build watch-based logic on a separate standard Kubernetes clientset"],"tags":["kubernetes","kops-controller","watch","unsupported-method"],"backgroundTag":"unsupported-clientset-method","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"}