{"record":{"id":"5678b7b593324af5","repo":"kubernetes/kops","slug":"parsing-taints-for-instance-group-q-w","errorCode":null,"errorMessage":"parsing taints for instance group %q: %w","messagePattern":"parsing taints for instance group %q: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/template_functions.go","lineNumber":1215,"sourceCode":"\t\tif !ok {\n\t\t\treturn \"\", fmt.Errorf(\"server group task for instance group %q has unexpected type %T\", ig.Name, task)\n\t\t}\n\n\t\tnodeLabels, err := nodelabels.BuildNodeLabels(tf.Cluster, ig)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"building node labels for instance group %q: %w\", ig.Name, err)\n\t\t}\n\n\t\tuserDataBytes, err := fi.ResourceAsBytes(serverGroup.UserData)\n\t\tif err != nil {\n\t\t\treturn \"\", fmt.Errorf(\"reading user-data for instance group %q: %w\", ig.Name, err)\n\t\t}\n\n\t\tvar taints []corev1.Taint\n\t\tfor _, taintSpec := range ig.Spec.Taints {\n\t\t\tparsed, err := util.ParseTaint(taintSpec)\n\t\t\tif err != nil {\n\t\t\t\treturn \"\", fmt.Errorf(\"parsing taints for instance group %q: %w\", ig.Name, err)\n\t\t\t}\n\t\t\ttaints = append(taints, corev1.Taint{\n\t\t\t\tKey:    parsed[\"key\"],\n\t\t\t\tValue:  parsed[\"value\"],\n\t\t\t\tEffect: corev1.TaintEffect(parsed[\"effect\"]),\n\t\t\t})\n\t\t}\n\n\t\t// Copy the server labels and add the user-data hash.\n\t\tserverLabels := make(map[string]string, len(serverGroup.Labels)+1)\n\t\tfor key, value := range serverGroup.Labels {\n\t\t\tserverLabels[key] = value\n\t\t}\n\t\tserverLabels[hetzner.TagKubernetesInstanceUserData] = hetznertasks.SafeBytesHash(userDataBytes)\n\n\t\tconfig.NodeConfigs[ig.Name] = hcloudNodeConfig{\n\t\t\tCloudInit:    string(userDataBytes),\n\t\t\tLabels:       nodeLabels,","sourceCodeStart":1197,"sourceCodeEnd":1233,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/template_functions.go#L1197-L1233","documentation":"HCloudClusterConfig parses each entry of ig.Spec.Taints using util.ParseTaint to build corev1.Taint values. If a taint string is malformed, ParseTaint errors and this wrapper reports it with the instance group name.","triggerScenarios":"An instance group spec contains a taint string not in key=value:effect format (e.g. missing '=', missing ':effect', empty effect, extra separators).","commonSituations":"Hand-edited cluster.yaml taints with typos like \"dedicated=true\" (missing :effect) or \"key=value:NoSchdule\" (misspelled effect); copy-pasting taints between tools with different syntaxes.","solutions":["Fix the taint string in ig.Spec.Taints to the canonical key=value:Effect form, e.g. dedicated=foo:NoSchedule.","Validate effects are one of NoSchedule, PreferNoSchedule, NoExecute.","Run a spec validation / kops toolbox before applying."],"exampleFix":"// before (cluster.yaml)\ntaints:\n  - dedicated=gpu\n// after\ntaints:\n  - dedicated=gpu:NoSchedule","handlingStrategy":"validation","validationCode":"// Go: validate taints before template execution\nfor _, t := range ig.Spec.Taints {\n    parts := strings.Split(t, \":\")\n    if len(parts) != 2 || !strings.Contains(parts[0], \"=\") {\n        return fmt.Errorf(\"ig %q: taint %q must be key=value:Effect\", ig.Name, t)\n    }\n    switch corev1.TaintEffect(parts[1]) {\n    case corev1.TaintEffectNoSchedule, corev1.TaintEffectPreferNoSchedule, corev1.TaintEffectNoExecute:\n    default:\n        return fmt.Errorf(\"ig %q: taint %q has invalid effect %q\", ig.Name, t, parts[1])\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always write taints as key=value:NoSchedule|PreferNoSchedule|NoExecute","Validate cluster specs with kops before apply","Lint taint fields in CI for hand-edited manifests"],"tags":["hetzner","taints","config-validation"],"backgroundTag":"invalid-taint-format","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"}