Skip to content

Update plugin API to allow new resources creation #139

Description

@aufi

Phase 1 of migtools/crane#415

Phase 1: crane-lib API Extension Summary

This phase updates crane-lib to allow transform plugins to generate entirely new Kubernetes resources. The implementation ensures full backward compatibility without the need for a V2 API.

Core Architecture Updates

  • Extended API: Both PluginResponse and RunnerResponse now include a NewResources field to hold standard Kubernetes unstructured objects.
  • Graceful Degradation: Relies on the JSON omitempty tag. Older plugins simply omit this field, which automatically resolves to an empty list without breaking the execution.
  • Simplified Runner Logic: The runner iterates through plugins and aggregates any NewResources provided. It avoids complex version validation, relying solely on whether the new resources array contains items.

Unit Testing Coverage

  • Generating single or multiple new resources.
  • Replacing an original resource (whiteout) with a new one.
  • Verifying backward compatibility with older plugins.
  • Aggregating outputs from multiple plugins and handling explicitly empty lists.

More details on https://github.com/aufi/move-crane/blob/main/drafts/plugin-update-new-resource-plan.md#phase-1-crane-lib-api-extension-tasks-1-2-4

Metadata

Metadata

Assignees

Labels

Type

No type

Fields

No fields configured for issues without a type.

Projects

Status
Done

Relationships

None yet

Development

No branches or pull requests

Issue actions