kubernetes/kops · error

error remapping manifest %s: %v

Error message

error remapping manifest %s: %v

What it means

With rendering done, Normalize calls addonmanifests.RemapAddonManifest to rewrite the manifest (image assets, service accounts, cluster references). On failure it logs the offending manifest bytes via klog and returns this error containing the addon location and the underlying cause. Remapping failing usually means the manifest YAML is not a valid/parseable addon manifest or references things that cannot be rewritten.

Source

Thrown at upup/pkg/fi/cloudup/bootstrapchannelbuilder/addonmanifest.go:100

	}

	manifestBytes, err := fi.ResourceAsBytes(a.source)
	if err != nil {
		return fmt.Errorf("error reading addon %q manifest: %v", fi.ValueOf(a.Name), err)
	}

	if !a.skipRender && a.addonRenderer != nil {
		manifestBytes, err = a.addonRenderer.RenderTemplate(fi.ValueOf(a.Location), manifestBytes, tasksVisibleToAddons(c.AllTasks()))
		if err != nil {
			return fmt.Errorf("error rendering addon %q template: %w", fi.ValueOf(a.Name), err)
		}
	}

	if !a.skipRemap {
		manifestBytes, err = addonmanifests.RemapAddonManifest(a.addonSpec, a.modelContext, a.assetBuilder, manifestBytes, a.serviceAccounts)
		if err != nil {
			klog.Infof("invalid manifest: %s", string(manifestBytes))
			return fmt.Errorf("error remapping manifest %s: %v", fi.ValueOf(a.Location), err)
		}
	}

	manifestBytes = []byte(strings.TrimSpace(string(manifestBytes)))

	if a.buildPrune {
		if err := buildPruneDirectives(a.addonSpec, manifestBytes); err != nil {
			return fmt.Errorf("failed to configure pruning for %s: %w", fi.ValueOf(a.addonSpec.Name), err)
		}
	}

	rawManifest := string(manifestBytes)
	manifestHash, err := utils.HashString(rawManifest)
	if err != nil {
		return fmt.Errorf("error hashing manifest: %v", err)
	}
	a.addonSpec.ManifestHash = manifestHash
	a.Contents = fi.NewBytesResource(manifestBytes)

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Inspect the 'invalid manifest: ...' log line immediately preceding the error to see the exact bytes kOps tried to remap
  2. Validate the manifest YAML parses (yamllint / kubectl apply --dry-run) and fix syntax or missing metadata
  3. Check the inner error from RemapAddonManifest in the message and fix the referenced resource (e.g. missing image, bad service account reference)
  4. If a kOps upgrade caused it, update the addon manifest to the format expected by your kOps version or set skipRemap only if you truly manage assets yourself

Example fix

// before (manifest missing apiVersion/kind)
metadata:
  name: my-addon
// after
apiVersion: v1
kind: Deployment
metadata:
  name: my-addon
Defensive patterns

Strategy: try-catch

Validate before calling

// validate the manifest parses before normalization
if err := yaml.Unmarshal(manifestBytes, &map[string]interface{}{}); err != nil {
    return fmt.Errorf("addon %s manifest is not valid YAML: %w", addonName, err)
}

Try / catch

if err := m.Normalize(ctx); err != nil && strings.Contains(err.Error(), "error remapping manifest") {
    // klog already printed the offending bytes; parse/fix them, then retry
    log.Printf("remap failed: %v", err)
}

Prevention

When it happens

Trigger: Normalize runs with skipRemap=false and RemapAddonManifest returns an error while processing manifestBytes for the addon at fi.ValueOf(a.Location) — e.g. invalid YAML, an unmarshalable field, or missing metadata the remapper requires.

Common situations: A custom addon manifest that is not valid multi-document YAML or lacks required ObjectMeta; an addon manifest using fields the current kOps remapper cannot handle; a kOps upgrade changing RemapAddonManifest expectations; corrupted manifest bytes from an earlier (silently mangled) render step.

Related errors


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