{"record":{"id":"4e264cf934b55793","repo":"kubernetes/kops","slug":"building-corev1-client-w-4e264c","errorCode":null,"errorMessage":"building corev1 client: %w","messagePattern":"building corev1 client: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/kops-controller/controllers/metalipam.go","lineNumber":45,"sourceCode":"\tcorev1client \"k8s.io/client-go/kubernetes/typed/core/v1\"\n\t\"k8s.io/klog/v2\"\n\tkopsapi \"k8s.io/kops/pkg/apis/kops/v1alpha2\"\n\tctrl \"sigs.k8s.io/controller-runtime\"\n\t\"sigs.k8s.io/controller-runtime/pkg/client\"\n\t\"sigs.k8s.io/controller-runtime/pkg/manager\"\n)\n\n// NewMetalIPAMReconciler is the constructor for a MetalIPAMReconciler\nfunc NewMetalIPAMReconciler(ctx context.Context, mgr manager.Manager) (*MetalIPAMReconciler, error) {\n\tklog.Info(\"starting metal ipam controller\")\n\tr := &MetalIPAMReconciler{\n\t\tclient: mgr.GetClient(),\n\t\tlog:    ctrl.Log.WithName(\"controllers\").WithName(\"metal_ipam\"),\n\t}\n\n\tcoreClient, err := corev1client.NewForConfig(mgr.GetConfig())\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"building corev1 client: %w\", err)\n\t}\n\tr.coreV1Client = coreClient\n\n\treturn r, nil\n}\n\n// MetalIPAMReconciler observes Node objects, assigning their `PodCIDRs` from the instance's `ExternalIpv6`.\ntype MetalIPAMReconciler struct {\n\t// client is the controller-runtime client\n\tclient client.Client\n\n\t// log is a logr\n\tlog logr.Logger\n\n\t// coreV1Client is a client-go client for patching nodes\n\tcoreV1Client *corev1client.CoreV1Client\n}\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/cmd/kops-controller/controllers/metalipam.go#L27-L63","documentation":"NewMetalIPAMReconciler builds a typed corev1 client from the controller-runtime manager's REST config; this wraps that construction failing. Like other client builders, it is an internal setup error in the auth/transport configuration rather than a cluster interaction.","triggerScenarios":"Thrown at cmd/kops-controller/controllers/metalipam.go:45 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the wrapped client-go error for the invalid config field","Verify kops-controller's credentials and REST config are valid","Restart the controller after fixing credential configuration"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}