UNPKG

@gorizond/catalog-backend-module-fleet

Version:

Backstage catalog backend module for Rancher Fleet GitOps entities

83 lines (82 loc) 2.85 kB
/** * Fleet Entity Provider * Provides Backstage Catalog entities from Rancher Fleet GitOps resources * * Entity Mapping: * - Fleet Cluster (config) → Domain * - GitRepo → System * - Bundle → Component (type: service) * - BundleDeployment → Resource (type: fleet-deployment) */ import { LoggerService, SchedulerServiceTaskScheduleDefinition } from "@backstage/backend-plugin-api"; import { Config } from "@backstage/config"; import { EntityProvider, EntityProviderConnection } from "@backstage/plugin-catalog-node"; import { FleetClusterConfig } from "./types"; import type { FleetK8sLocator } from "./k8sLocator"; export interface FleetProviderFactoryOptions { logger: LoggerService; k8sLocator?: FleetK8sLocator; } export interface FleetProviderOptions { id: string; clusters: FleetClusterConfig[]; schedule: SchedulerServiceTaskScheduleDefinition; logger: LoggerService; concurrency?: number; k8sLocator?: FleetK8sLocator; } export declare class FleetEntityProvider implements EntityProvider { private readonly logger; private readonly clusters; private readonly schedule; private readonly locationKey; private readonly concurrency; private readonly k8sLocator?; private connection?; private clusterNameMap?; private readonly clusterWorkspaces; private readonly clusterPrimaryWorkspace; private clusterStats?; private addDiscoveredClustersToBatch; private addNodesViaRancher; /** * Create FleetEntityProvider instances from configuration */ static fromConfig(config: Config, options: FleetProviderFactoryOptions): FleetEntityProvider[]; private static createFromConfig; constructor(options: FleetProviderOptions); getProviderName(): string; getSchedule(): SchedulerServiceTaskScheduleDefinition; private dedupeEntities; private recordWorkspaceNamespace; private getPrimaryWorkspace; private populateClusterNameMap; private collectClusterTopology; connect(connection: EntityProviderConnection): Promise<void>; /** * Main run method - fetches all Fleet resources and emits entities */ run(): Promise<void>; /** * Fetch all Fleet resources from a single cluster */ private fetchCluster; /** * Fetch all Fleet resources from a single namespace */ private fetchNamespace; /** * Process a single GitRepo and its related resources */ private processGitRepo; /** * Process a single Bundle and its related resources */ private processBundle; /** * Fetch fleet.yaml from Git repository * Note: This is a placeholder - actual implementation would need Git access */ private fetchFleetYaml; } export type { FleetNamespaceConfig, LabelSelector, FleetClusterConfig, } from "./types";