Skip to content

open-service-portal/ingestor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Backstage Ingestor Plugin

A powerful Backstage backend plugin that automatically discovers and imports Kubernetes resources into the Backstage catalog. This plugin provides seamless integration between your Kubernetes clusters and Backstage, enabling automatic discovery of services, deployments, and custom resources.

Originally forked from @terasky/backstage-plugin-kubernetes-ingestor, this plugin has been customized for the Open Service Portal project with enhanced features and simplified configuration.

Features

  • Automatic Resource Discovery: Continuously scans Kubernetes clusters for resources
  • Crossplane XRD Support: Discovers and imports Crossplane Composite Resource Definitions as templates
  • Namespace Filtering: Configurable inclusion/exclusion of namespaces
  • Multi-Cluster Support: Works with multiple Kubernetes clusters simultaneously
  • Custom Resource Support: Extensible to support any Kubernetes custom resource
  • Entity Metadata Enrichment: Automatically adds relevant Kubernetes metadata to catalog entities
  • XRD Template Generation: Automatically generates Backstage templates for Crossplane XRDs
  • GitOps Integration: Support for PR-based template registration (GitHub/GitLab/Bitbucket)
  • CLI Tools: Command-line tools for ingestion and export operations
  • Unified Architecture: Same ingestion engine used by both CLI and runtime
  • XR Status Links: Automatic extraction and generation of links from Kubernetes resource status fields

Installation

As a Local Plugin

Clone this repository into your Backstage app's plugins directory:

cd packages/backend/plugins
git clone https://github.com/open-service-portal/ingestor.git

Package Installation

Add the plugin to your backend:

yarn add --cwd packages/backend @open-service-portal/backstage-plugin-ingestor

Quick Start

Basic Configuration

Add to your app-config.yaml:

kubernetesIngestor:
  components:
    enabled: true
    excludedNamespaces:
      - kube-system
      - kube-public
  crossplane:
    enabled: true
    xrds:
      enabled: true

→ Full Configuration Reference

Documentation

For Users

For Developers

Backend Integration

Add the plugin to your backend in packages/backend/src/index.ts:

import { catalogModuleIngestor } from '@open-service-portal/backstage-plugin-ingestor';

// In your backend builder
backend.add(catalogModuleIngestor());

Kubernetes RBAC Requirements

The service account used by Backstage needs appropriate permissions. See K8S_RBAC.md for detailed RBAC configuration.

Architecture

The plugin consists of several key components:

  • Entity Providers: Scan Kubernetes resources and convert them to Backstage entities
  • Resource Fetchers: Handle communication with Kubernetes API
  • Entity Processors: Transform Kubernetes resources into catalog entities
  • Annotation Handlers: Manage entity relationships and metadata
  • Template Generators: Create Backstage templates from XRDs

For detailed architecture information, see docs/architecture.md.

Key Features Documentation

XR Status Links

The ingestor automatically extracts and generates navigation links from Kubernetes resource status fields. This feature is particularly valuable for Crossplane XRs where compositions populate status with URLs, endpoints, and connection information.

→ Full XR Status Links Documentation

  • Supported status fields and formats
  • Implementation details and architecture
  • Configuration and customization
  • Examples and best practices

CLI Tools

The plugin includes two command-line tools that use the same ingestion engine as the runtime plugin:

Ingestor CLI

Process Kubernetes resources from files without running Backstage:

# Process XRD file
npx ts-node src/cli/ingestor-cli.ts xrd.yaml

# Preview generated template
npx ts-node src/cli/ingestor-cli.ts xrd.yaml --preview

# Process with custom tags
npx ts-node src/cli/ingestor-cli.ts xrd.yaml --tags "database,production"

→ Full Ingestor CLI Documentation

Export CLI

Extract entities from a running Backstage catalog:

# Export all templates
npx ts-node src/cli/backstage-export.ts --kind Template

# Export with filtering
npx ts-node src/cli/backstage-export.ts --kind Component --owner platform-team

# Preview what would be exported
npx ts-node src/cli/backstage-export.ts --kind Template --preview

→ Full Export CLI Documentation

Development

Prerequisites

  • Node.js 18+
  • Yarn 3.x
  • Access to a Kubernetes cluster
  • Backstage development environment

Setup

# Install dependencies
yarn install

# Build the plugin
yarn build

# Build CLI tools
yarn build:cli

# Run tests
yarn test

# Start in development mode
yarn start

Testing CLI Tools

# Test ingestor CLI locally
yarn cli:ingestor examples/xrd.yaml --preview

# Test export CLI locally
yarn cli:export --list --kind Template

Testing with Local Backstage

  1. Link the plugin in your Backstage app:
cd packages/backend
yarn link @open-service-portal/backstage-plugin-ingestor
  1. Start Backstage in development mode:
yarn dev

Migration from TeraSky Plugin

If you're migrating from the original TeraSky plugin:

  1. Update your import statements:
// Before
import { catalogModuleKubernetesIngestor } from '@terasky/backstage-plugin-kubernetes-ingestor';

// After
import { catalogModuleIngestor } from '@open-service-portal/backstage-plugin-ingestor';
  1. Update your configuration keys if needed (most remain compatible)

Contributing

We welcome contributions! Please see our Contributing Guide for details.

Key Areas for Contribution

  • Additional Kubernetes resource types
  • Enhanced filtering capabilities
  • Performance optimizations
  • Documentation improvements

Support

Credits

This plugin is based on the excellent work by TeraSky on their kubernetes-ingestor plugin.

License

Apache 2.0 - See LICENSE for details.

About

Backstage plugin for automatic Kubernetes resource discovery and catalog ingestion

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published