{"record":{"id":"0e84278a5c954f65","repo":"kubernetes/kops","slug":"method-configbasefor-not-supported-in-server-side","errorCode":null,"errorMessage":"method ConfigBaseFor not supported in server-side client","messagePattern":"method ConfigBaseFor not supported in server-side client","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/pkg/controllerclientset/clientset.go","lineNumber":102,"sourceCode":"\n// CreateCluster creates a cluster\nfunc (c *client) CreateCluster(ctx context.Context, cluster *kops.Cluster) (*kops.Cluster, error) {\n\treturn nil, fmt.Errorf(\"method CreateCluster not supported in server-side client\")\n}\n\n// UpdateCluster updates a cluster\nfunc (c *client) UpdateCluster(ctx context.Context, cluster *kops.Cluster, status *kops.ClusterStatus) (*kops.Cluster, error) {\n\treturn nil, fmt.Errorf(\"method UpdateCluster not supported in server-side client\")\n}\n\n// ListClusters returns all clusters\nfunc (c *client) ListClusters(ctx context.Context, options metav1.ListOptions) (*kops.ClusterList, error) {\n\treturn nil, fmt.Errorf(\"method ListClusters not supported in server-side client\")\n}\n\n// ConfigBaseFor returns the vfs path where we will read configuration information from\nfunc (c *client) ConfigBaseFor(cluster *kops.Cluster) (vfs.Path, error) {\n\treturn nil, fmt.Errorf(\"method ConfigBaseFor not supported in server-side client\")\n}\n\n// InstanceGroupsFor returns the InstanceGroupInterface bound to the namespace for a particular Cluster\nfunc (c *client) InstanceGroupsFor(cluster *kops.Cluster) kopsinternalversion.InstanceGroupInterface {\n\tclusterName := cluster.Name\n\tif clusterName != c.clusterName {\n\t\tklog.Fatalf(\"clientset bound to cluster %q, got cluster %q\", c.clusterName, clusterName)\n\t}\n\n\treturn newInstanceGroups(c.vfsContext, cluster, c.clusterBasePath)\n}\n\n// AddonsFor returns the client for addon objects for a particular Cluster\nfunc (c *client) AddonsFor(cluster *kops.Cluster) simple.AddonsClient {\n\tclusterName := cluster.Name\n\tif clusterName != c.clusterName {\n\t\tklog.Fatalf(\"clientset bound to cluster %q, got cluster %q\", c.clusterName, clusterName)\n\t}","sourceCodeStart":84,"sourceCodeEnd":120,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/pkg/controllerclientset/clientset.go#L84-L120","documentation":"ConfigBaseFor returns the VFS path of a cluster's configuration base in the classic CLI clientset. In the server-side controller clientset the concept is intentionally unsupported, and the stub returns this error. Callers must not rely on VFS paths when running server-side.","triggerScenarios":"Calling client.ConfigBaseFor(cluster) from controller code, e.g. to compute a state-store path for reading or writing cluster config directly.","commonSituations":"Code shared with CLI utilities that need the config base path (sshcredentialstore, nodeup bootstrap) being invoked in the controller process.","solutions":["Do not resolve VFS config paths from the server-side client; use the controller's abstractions (InstanceGroupsFor, SSHCredentialStoreFor already handle paths internally)","If a path is truly needed, construct it from the controller's configured cluster base path rather than the clientset","Move the path-dependent logic to a CLI/VFS-backed tool"],"exampleFix":"// before\nbasePath, err := client.ConfigBaseFor(cluster)\n// after: use the methods that already encapsulate the path\nigStore := client.InstanceGroupsFor(cluster)\nsshStore, err := client.SSHCredentialStoreFor(cluster)","handlingStrategy":"validation","validationCode":"var pathGetter interface{ ConfigBaseFor(*kops.Cluster) (vfs.Path, error) } = client\nif _, ok := pathGetter.(interface{ ConfigBaseFor(*kops.Cluster) (vfs.Path, error) }); ok {\n  _, err := pathGetter.ConfigBaseFor(cluster)\n  _ = err // only VFS-backed clients support this\n}","typeGuard":"func hasConfigBase(c interface{}) bool {\n  _, ok := c.(interface{ ConfigBaseFor(*kops.Cluster) (vfs.Path, error) })\n  return ok\n}","tryCatchPattern":"basePath, err := client.ConfigBaseFor(cluster)\nif err != nil && strings.Contains(err.Error(), \"ConfigBaseFor not supported\") {\n  // derive from configured cluster base path instead\n  basePath = c.clusterBasePath\n}","preventionTips":["Use the higher-level methods (InstanceGroupsFor, SSHCredentialStoreFor) that encapsulate paths","Avoid direct VFS path computation when running server-side","Keep path-dependent logic in CLI tools"],"tags":["go","unsupported-operation","kops","vfs"],"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"}