{"record":{"id":"e45f936ec4735383","repo":"kubernetes/kops","slug":"querying-node-q-w","errorCode":null,"errorMessage":"querying node %q: %w","messagePattern":"querying node %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"channels/pkg/nodelabeler/labeler.go","lineNumber":49,"sourceCode":"type nodePatch struct {\n\tMetadata *nodePatchMetadata `json:\"metadata,omitempty\"`\n}\n\ntype nodePatchMetadata struct {\n\tLabels map[string]string `json:\"labels,omitempty\"`\n}\n\n// BootstrapControlPlaneNodeLabels applies labels to the current node so that it acts as a control-plane.\n// Safe to call repeatedly: the patch is skipped when the labels already match.\nfunc BootstrapControlPlaneNodeLabels(ctx context.Context, client kubernetes.Interface, nodeName string, nodeLabels map[string]string) error {\n\tif nodeName == \"\" {\n\t\treturn fmt.Errorf(\"node name is required\")\n\t}\n\n\tklog.V(2).Infof(\"querying k8s for node %q\", nodeName)\n\tnode, err := client.CoreV1().Nodes().Get(ctx, nodeName, metav1.GetOptions{})\n\tif err != nil {\n\t\treturn fmt.Errorf(\"querying node %q: %w\", nodeName, err)\n\t}\n\n\tlabels := nodelabels.BuildMandatoryControlPlaneLabels(nodeLabels)\n\n\tshouldPatch := false\n\tfor k, v := range labels {\n\t\tif actual, found := node.Labels[k]; !found || actual != v {\n\t\t\tshouldPatch = true\n\t\t\tbreak\n\t\t}\n\t}\n\tif !shouldPatch {\n\t\treturn nil\n\t}\n\n\tklog.V(2).Infof(\"patching node %q to add labels %v\", nodeName, labels)\n\tpatch, err := json.Marshal(&nodePatch{\n\t\tMetadata: &nodePatchMetadata{Labels: labels},","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/channels/pkg/nodelabeler/labeler.go#L31-L67","documentation":"BootstrapControlPlaneNodeLabels fetches the Node object from the API to compare labels; this wraps that GET failing. The node name was provided, so the fault is an API-level error: node not found yet, RBAC denial, or connectivity.","triggerScenarios":"Thrown at channels/pkg/nodelabeler/labeler.go:49 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the node object with the given name exists (node registration may lag boot)","Check RBAC allows the kops-channels service account to get nodes","Inspect the wrapped error for the API server reason"],"exampleFix":null,"handlingStrategy":"retry","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-12T07:17:12.445Z"}