kubernetes/kops · error

featureGates: %w

Error message

featureGates: %w

What it means

parseFeatureGates converts the kops map[string]string FeatureGates into map[string]bool using strconv.ParseBool. A value that is not a valid Go boolean literal (true/false/1/0/t/f/T/F/TRUE/FALSE etc.) fails ParseBool and is wrapped as "featureGates: %w" with detail "invalid feature gate value \"name\"=\"raw\"".

Source

Thrown at nodeup/pkg/model/kubelet.go:410

	evictionSoft, err := parseKeyValueList(kubeletConfig.EvictionSoft, "<")
	if err != nil {
		return nil, fmt.Errorf("evictionSoft: %w", err)
	}
	cc.EvictionSoft = evictionSoft
	evictionSoftGracePeriod, err := parseKeyValueList(kubeletConfig.EvictionSoftGracePeriod, "=")
	if err != nil {
		return nil, fmt.Errorf("evictionSoftGracePeriod: %w", err)
	}
	cc.EvictionSoftGracePeriod = evictionSoftGracePeriod
	evictionMinimumReclaim, err := parseKeyValueList(kubeletConfig.EvictionMinimumReclaim, "=")
	if err != nil {
		return nil, fmt.Errorf("evictionMinimumReclaim: %w", err)
	}
	cc.EvictionMinimumReclaim = evictionMinimumReclaim

	featureGates, err := parseFeatureGates(kubeletConfig.FeatureGates)
	if err != nil {
		return nil, fmt.Errorf("featureGates: %w", err)
	}
	cc.FeatureGates = featureGates

	if kubeletConfig.EnforceNodeAllocatable != "" {
		cc.EnforceNodeAllocatable = strings.Split(kubeletConfig.EnforceNodeAllocatable, ",")
	}

	for _, t := range kubeletConfig.Taints {
		taint, err := parseTaint(t)
		if err != nil {
			return nil, fmt.Errorf("taints: %w", err)
		}
		cc.RegisterWithTaints = append(cc.RegisterWithTaints, taint)
	}

	return cc, nil
}

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Set each feature gate value to a boolean literal: true/false (1/0/t/f also accepted)
  2. Check the wrapped message for the offending gate name and value
  3. In kops spec use featureGates: {GateName: "true"} format
  4. Upgrade kops if a newly-added gate is being mangled by an old version

Example fix

// before
kubelet:
  featureGates:
    CSIMigration: "enabled"
// after
kubelet:
  featureGates:
    CSIMigration: "true"
Defensive patterns

Strategy: validation

Validate before calling

func validFeatureGates(gates map[string]string) error {
    for name, raw := range gates {
        if _, err := strconv.ParseBool(raw); err != nil {
            return fmt.Errorf("gate %s=%q is not boolean", name, raw)
        }
    }
    return nil
}

Try / catch

if err := parseFeatureGates(cfg.FeatureGates); err != nil {
    return fmt.Errorf("feature gate values must be true/false: %w", err)
}

Prevention

When it happens

Trigger: kubeletConfiguration -> parseFeatureGates(kubeletConfig.FeatureGates) fails when any gate value in spec.kubelet.featureGates is not a parseable boolean string.

Common situations: Setting featureGates with YAML-like "True" is fine, but "enabled", "yes", "on", or quoted strings with whitespace are not; copying command-line --feature-gates=Foo=true syntax into a map value leaving "Foo=true" as the value itself.

Related errors


AI-assisted analysis of kubernetes/kops@4c8573c808 (2026-09-05). Data as JSON: /api/errors/d6ab7189643b1fbd. Report an issue: GitHub.