kubernetes/kops · error

error pruning manifest

Error message

error pruning manifest: %w

What it means

In updateAddon, the pruner failed while pruning objects listed in the manifest according to the addon's prune spec. The apply step may have succeeded; this wraps the prune failure, and both errors are accumulated via multierr.

Solutions

  1. Inspect the wrapped error for the Kubernetes API failure during prune listing or deletion
  2. Check that the prune label/field selectors and namespaces in the addon spec are valid
  3. Verify RBAC permissions allow deleting the pruned resources
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at channels/pkg/channels/addon.go:208 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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

Appendix: source

Thrown at channels/pkg/channels/addon.go:208

	}

	klog.Infof("Applying update from %q", manifestURL)

	// We copy the manifest to a temp file because it is likely e.g. an s3 URL, which kubectl can't read
	data, err := vfsContext.ReadFile(manifestURL.String())
	if err != nil {
		return fmt.Errorf("error reading manifest: %w", err)
	}

	var merr error
	var applyError, pruneError error

	if applyError = applier.Apply(ctx, data); applyError != nil {
		merr = multierr.Append(merr, fmt.Errorf("error applying update: %w", applyError))
	}

	if pruneError = pruner.Prune(ctx, data, a.Spec.Prune); pruneError != nil {
		merr = multierr.Append(merr, fmt.Errorf("error pruning manifest: %w", pruneError))
	}

	if applyError != nil && pruneError == nil {
		// If we failed to apply, but not prune, we should try to apply again
		if err := applier.Apply(ctx, data); err != nil {
			merr = multierr.Append(merr, fmt.Errorf("error applying update after prune: %w", err))
		} else {
			// If we succeeded to apply after prune, clear the errors
			merr = nil
		}
	}

	if merr != nil {
		return fmt.Errorf("error updating addon from %q: %w", manifestURL, merr)
	}

	if err := a.AddNeedsUpdateLabel(ctx, k8sClient, required); err != nil {
		return fmt.Errorf("error adding needs-update label: %v", err)

View on GitHub (pinned to 4c8573c808)