1.0.0 • Published 5 months ago
@terasky/backstage-plugin-crossplane-claim-updater v1.0.0
Crossplane Claim Updater Plugin
Welcome to the crossplane-claim-updater plugin!
The Crossplane Claim Updater plugin provides a form component for updating Crossplane claim manifests in Git repositories. It uses the OpenAPI schema from the corresponding XRD to generate a dynamic form for updating claim specifications.
Features
- Dynamic form generation based on XRD OpenAPI schemas
- Support for GitHub repositories through Backstage's SCM integration
- Automatic PR creation with changes
- Support for both entity annotations and manual URL input
- Preserves file paths and directory structure
Installation
From your Backstage root directory, run:
yarn add --cwd packages/app @terasky/backstage-plugin-crossplane-claim-updater
Adding the plugins field extension to your Backstage apps scaffolder route:
// packages/app/src/App.tsx
import { GitClaimUpdaterExtension } from '@terasky/backstage-plugin-crossplane-claim-updater';
import { ScaffolderFieldExtensions } from '@backstage/plugin-scaffolder-react';
const routes = (
<FlatRoutes>
...
<Route path="/create" element={<ScaffolderPage />}>
<ScaffolderFieldExtensions>
<GitClaimUpdaterExtension />
</ScaffolderFieldExtensions>
</Route>
...
</FlatRoutes>
);
Integrate the plugin with the entity scaffolder plugin:
// packages/app/src/components/catalog/EntityPage.tsx
import { GitClaimUpdaterExtension } from '@terasky/backstage-plugin-crossplane-claim-updater';
import { ScaffolderFieldExtensions } from '@backstage/plugin-scaffolder-react';
const crossplaneEntityPage = (
<EntityLayout>
...
<EntityLayout.Route path="/scaffolder" title="Entity Scaffolder">
<EntityScaffolderContent
templateGroupFilters={[
{
title: 'Management Templates',
filter: (entity, template) =>
template.metadata?.labels?.target === 'component' &&
entity.metadata?.annotations?.['backstage.io/managed-by-location']?.split(":")[0] === 'cluster origin',
},
]}
buildInitialState={entity => ({
entity: stringifyEntityRef(entity)
}
)}
ScaffolderFieldExtensions={
<ScaffolderFieldExtensions>
<RepoUrlPickerFieldExtension />
<EntityPickerFieldExtension />
<GitClaimUpdaterExtension />
</ScaffolderFieldExtensions>
}
/>
</EntityLayout.Route>
...
</EntityLayoutWrapper>
);
Add the Example Template to your Backstage app
The example template is located in the templates directory. This template utilizes the GitClaimUpdaterExtension to update a claim manifest in a GitHub repository.