{"record":{"id":"9c67fb738a3b7fe1","repo":"kubernetes/kops","slug":"node-name-is-required","errorCode":null,"errorMessage":"node name is required","messagePattern":"node name is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"channels/pkg/nodelabeler/labeler.go","lineNumber":43,"sourceCode":"\t\"k8s.io/apimachinery/pkg/types\"\n\t\"k8s.io/client-go/kubernetes\"\n\t\"k8s.io/klog/v2\"\n\t\"k8s.io/kops/pkg/nodelabels\"\n)\n\ntype 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 {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/channels/pkg/nodelabeler/labeler.go#L25-L61","documentation":"BootstrapControlPlaneNodeLabels requires the name of the node to label; this guard fires when the nodeName argument is empty (typically because the node-name source, e.g. NODE_NAME, was not provided by the caller in runApplyChannelIteration).","triggerScenarios":"Thrown at channels/pkg/nodelabeler/labeler.go:43 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the node name is passed to the labeler (e.g. NODE_NAME env from the downward API)","Verify the pod spec for kops-channels sets the node name field/env"],"exampleFix":null,"handlingStrategy":"validation","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"}