{"record":{"id":"53d7c2fed78ce010","repo":"kubernetes/kops","slug":"invalid-feature-gate-value-q-q-w","errorCode":null,"errorMessage":"invalid feature gate value %q=%q: %w","messagePattern":"invalid feature gate value %q=%q: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodeup/pkg/model/kubelet.go","lineNumber":563,"sourceCode":"\t\tEffect: v1.TaintEffect(parsed[\"effect\"]),\n\t}, nil\n}\n\n// parseFeatureGates converts the kops map[string]string feature-gate\n// representation into the map[string]bool that the kubelet config schema\n// requires. Values are parsed with strconv.ParseBool, so \"true\"/\"false\",\n// \"1\"/\"0\", \"t\"/\"f\" etc. are all accepted. An empty or nil input returns\n// (nil, nil); an unparseable value returns an error naming the offending\n// gate.\nfunc parseFeatureGates(gates map[string]string) (map[string]bool, error) {\n\tif len(gates) == 0 {\n\t\treturn nil, nil\n\t}\n\tout := make(map[string]bool, len(gates))\n\tfor name, raw := range gates {\n\t\tparsed, err := strconv.ParseBool(raw)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid feature gate value %q=%q: %w\", name, raw, err)\n\t\t}\n\t\tout[name] = parsed\n\t}\n\treturn out, nil\n}\n\n// buildSystemdService is responsible for generating the kubelet systemd unit\nfunc (b *KubeletBuilder) buildSystemdService() *nodetasks.Service {\n\tkubeletCommand := b.kubeletPath()\n\n\tmanifest := &systemd.Manifest{}\n\tmanifest.Set(\"Unit\", \"Description\", \"Kubernetes Kubelet Server\")\n\tmanifest.Set(\"Unit\", \"Documentation\", \"https://github.com/kubernetes/kubernetes\")\n\tmanifest.Set(\"Unit\", \"After\", \"containerd.service\")\n\n\tmanifest.Set(\"Service\", \"EnvironmentFile\", \"/etc/sysconfig/kubelet\")\n\n\tmanifest.Set(\"Service\", \"ExecStart\", kubeletCommand+\" \\\"$DAEMON_ARGS\\\"\")","sourceCodeStart":545,"sourceCodeEnd":581,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/nodeup/pkg/model/kubelet.go#L545-L581","documentation":"parseFeatureGates in nodeup/pkg/model/kubelet.go parses kubelet feature-gate values from cluster config into booleans via strconv.ParseBool. If a gate's raw string value is not a valid Go boolean literal, the ParseBool error is wrapped with the gate name and value. kOps stores feature gates as a map of raw strings, so malformed values are only caught here at nodeup build time.","triggerScenarios":"A KubeletConfig featureGates entry whose value is not one of \"1\",\"t\",\"T\",\"TRUE\",\"true\",\"True\",\"0\",\"f\",\"F\",\"FALSE\",\"false\",\"False\" — e.g. featureGates: {CustomResourceValidation: \"enabled\"} or \"on\". Raised while kubeletConfiguration model builder (or an anonymous caller) runs parseFeatureGates during nodeup build.","commonSituations":"Typing feature gate values as on/off/yes/enabled instead of true/false; YAML interprets unquoted yes/no into booleans in some tools but here they arrive as strings; copy-pasting flags like '-v=2' into a gate value.","solutions":["Change the feature gate value in the cluster spec to \"true\" or \"false\" (quoted strings).","Run `kops edit cluster`/`kops edit instancegroup` and fix the kubelet featureGates map, then `kops update cluster`.","Check for YAML coercion surprises: quote values explicitly (\"true\": \"true\") so they remain strings parseable by ParseBool."],"exampleFix":"// before (kops cluster spec)\nkubelet:\n  featureGates:\n    TopologyManager: \"enabled\"\n// after\nkubelet:\n  featureGates:\n    TopologyManager: \"true\"","handlingStrategy":"validation","validationCode":"// validate kubelet feature gates before applying the cluster spec\nfor name, v := range kubelet.FeatureGates {\n\tif _, err := strconv.ParseBool(v); err != nil {\n\t\treturn fmt.Errorf(\"feature gate %q has invalid boolean value %q\", name, v)\n\t}\n}","typeGuard":"func isValidGateValue(v string) bool {\n\t_, err := strconv.ParseBool(v)\n\treturn err == nil\n}","tryCatchPattern":null,"preventionTips":["Always quote feature gate values as \"true\"/\"false\" in YAML cluster specs","Avoid yes/no/on/off styles that are valid elsewhere but not for Go ParseBool","Validate the cluster spec with `kops toolbox` / dry-run before `kops update cluster --yes`"],"tags":["kubelet","feature-gates","config-validation"],"backgroundTag":"invalid-boolean-value","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"}