UNPKG

@gorizond/catalog-backend-module-fleet

Version:

Backstage catalog backend module for Rancher Fleet GitOps entities

54 lines (53 loc) 2.56 kB
/** * Fleet Kubernetes Client * Wrapper around @kubernetes/client-node for Fleet CRDs */ import { LoggerService } from "@backstage/backend-plugin-api"; import { FleetGitRepo, FleetBundle, FleetBundleDeployment, FleetCluster, FleetClusterGroup, FleetClusterConfig, LabelSelector } from "./types"; export interface FleetClientOptions { cluster: FleetClusterConfig; logger: LoggerService; } export interface ListOptions { namespace?: string; labelSelector?: string; fieldSelector?: string; limit?: number; continueToken?: string; } export declare class FleetClient { private readonly customApi; private readonly coreApi; private readonly logger; private readonly clusterName; constructor(options: FleetClientOptions); private createKubeConfig; listGitRepos(options?: ListOptions): Promise<FleetGitRepo[]>; getGitRepo(namespace: string, name: string): Promise<FleetGitRepo | undefined>; listBundles(options?: ListOptions): Promise<FleetBundle[]>; getBundle(namespace: string, name: string): Promise<FleetBundle | undefined>; listBundlesForGitRepo(namespace: string, gitRepoName: string): Promise<FleetBundle[]>; listBundleDeployments(options?: ListOptions): Promise<FleetBundleDeployment[]>; listBundleDeploymentsForBundle(bundleName: string): Promise<FleetBundleDeployment[]>; getBundleDeployment(namespace: string, name: string): Promise<FleetBundleDeployment | undefined>; listClusters(options?: ListOptions): Promise<FleetCluster[]>; getCluster(namespace: string, name: string): Promise<FleetCluster | undefined>; listClusterGroups(options?: ListOptions): Promise<FleetClusterGroup[]>; listFleetNamespaces(): Promise<string[]>; listNamespacesWithPattern(pattern: string): Promise<string[]>; /** * Extract target cluster IDs from BundleDeployment namespaces * Namespace format: cluster-fleet-<workspace>-<cluster-id> */ static extractClusterIdFromNamespace(namespace: string): string | undefined; /** * Get all target cluster IDs for a bundle by examining its BundleDeployments */ getTargetClusterIds(bundleName: string): Promise<string[]>; /** * Get deployment status per cluster for a bundle */ getBundleDeploymentStatusByCluster(bundleName: string): Promise<Map<string, FleetBundleDeployment>>; } export declare function selectorToString(selector?: LabelSelector): string | undefined; export declare function createFleetClient(cluster: FleetClusterConfig, logger: LoggerService): FleetClient;