kubernetes/kops · error

addon source is not configured for %q

Error message

addon source is not configured for %q

What it means

AddonManifest.Normalize requires a source resource (the raw or template manifest bytes) before it can read the addon manifest. If a.source is nil there is nothing to read, render, hash, or attach to the channel, so normalization aborts with this message identifying the addon by name.

Source

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

// the task graph see fully realized state. Intentionally pessimistic: addon rendering is fast
// enough that over-depending is not worth the footgun of under-declaring.
func (a *AddonManifest) GetDependencies(tasks map[string]fi.CloudupTask) []fi.CloudupTask {
	dependencies := make([]fi.CloudupTask, 0, len(tasks))
	for _, task := range tasks {
		if isAddonTask(task) {
			continue
		}
		dependencies = append(dependencies, task)
	}
	return dependencies
}

func (a *AddonManifest) Normalize(c *fi.CloudupContext) error {
	if a.addonSpec == nil {
		return fmt.Errorf("addon spec is not configured for %q", fi.ValueOf(a.Name))
	}
	if a.source == nil {
		return fmt.Errorf("addon source is not configured for %q", fi.ValueOf(a.Name))
	}

	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))

View on GitHub (pinned to 4c8573c808)

Solutions

  1. Locate the AddonManifest construction for the named addon in bootstrapchannelbuilder and assign source (e.g. via fi.NewBytesResource or the channel's manifest resource)
  2. Use the existing buildAddonManifest helper instead of building AddonManifest directly so source is always wired
  3. In tests, set source: fi.NewBytesResource([]byte(...)) before calling Normalize
  4. Re-run go test ./upup/pkg/fi/cloudup/bootstrapchannelbuilder/... to confirm which addon is affected

Example fix

// before
m := &AddonManifest{Name: fi.PtrTo("kube-dns"), addonSpec: spec}
// after
m := &AddonManifest{Name: fi.PtrTo("kube-dns"), addonSpec: spec, source: fi.NewBytesResource(manifestBytes)}
Defensive patterns

Strategy: validation

Validate before calling

if m.source == nil {
    return fmt.Errorf("addon %s: source resource must be set before Normalize", fi.ValueOf(m.Name))
}

Type guard

func (a *AddonManifest) HasSource() bool { return a.source != nil }

Prevention

When it happens

Trigger: Normalize is called (directly or via task normalization; covered by TestAddonManifestNormalizeSkipsRenderForRawSources and TestAddonManifestNormalizeRendersTemplateSources) with addonSpec set but a.source never assigned — the builder step that maps the channel's manifest location into a fi.Resource was skipped or failed silently.

Common situations: A bootstrap channel builder branch that returns an AddonManifest without calling the helper that sets source from the addon's manifest path; a refactor that removed the fi.NewBytesResource/URL resource wiring; a test constructing AddonManifest manually with only Name and addonSpec.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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